> 4- I want when echo the return $row["address"] to highlight the entered > keyword (that the user has entered in the search form) in the output with a > different font backcolor or by just another color... to let the user see > what he was searching for
<? $length = strlen( $keyword ); $position = strpos( $row["address"], $keyword ); $row["address"] = substr_replace( $row["address"], "<span class=\"yourclass\">$keyword</span>, $position, $length ); ?> You must specify 'yourclass' in a stylesheet, obviously. While this is not nearly as eloquent as Cristian's suggested use of regular expressions, it seems better suited to your level of experience. As they say, if you need to ask... Edward Dudlik Becoming Digital www.becomingdigital.com ----- Original Message ----- From: "nabil" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, 18 June, 2003 02:44 Subject: [PHP-DB] PLS Advise, Highlighted Text from a Query Dear all, 1- I have a form with an input text : keyword 2- the field address is in my MySQL as TEXT field. 3- I select * from db where address like '%keyword%' 4- I want when echo the return $row["address"] to highlight the entered keyword (that the user has entered in the search form) in the output with a different font backcolor or by just another color... to let the user see what he was searching for 5- and if it possible to echo how accurate (percentage) the return rows has fit his search... Please Advise how to do it... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]