Edward , what about the percentage how much accurate the result returned?? "Becoming Digital" <subs@becomingdigital.com> wrote in message 001b01c335a5$cff2aed0$f5fa5044@becomingadmin">news:001b01c335a5$cff2aed0$f5fa5044@becomingadmin... > Oops! I sent this to the wrong list last night. This is what happens when > we answer emails @ 4:18 AM... > > > 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" <nabil.attar@aws-syria.com> > To: <php-db@lists.php.net> > Sent: Wednesday, 18 June, 2003 10:11 > Subject: Re: PLS Advise, Highlighted Text from a Query > > > Yes please that is what i want.. if it possible to give em the code.. > thanks in advance for you and for George Pitcher > > > "Cristian Marin" <cristic@iakt.rdsnet.ro> wrote in message > 20030618075554.73634.qmail@pb1.pair.com">news:20030618075554.73634.qmail@pb1.pair.com... > > Yes it is posible using the preg_replace substituing the text with </b>the > > text</b> or to what ever you want. > > > > If you are not advanced in php you could do it with substr_replace() > > function. > > > > The first solution is more dificult to be used but you have the advantage > > you can search for each word used in the %search_words% and highlight them > > even if they are not positioned in the same order in the text searched. > (But > > in this case you have to use the MySQL 'match against' with the full text > > indexing in place of like). > > > > The result is something like this: http://www.interakt.ro/search.php. Try > > searching 'mysql adodb' > > > > If this is what you want I can help you with a code block > > > > > > > > -- > > ------------------------------------------------- > > Cristian MARIN - Developer > > InterAKT Online (www.interakt.ro) > > Tel: +4021 312.53.12 > > Tel/Fax: +4021 312.51.91 > > cristic@interakt.ro > > "Nabil" <nabil.attar@aws-syria.com> wrote in message > > 20030618064522.21569.qmail@pb1.pair.com">news:20030618064522.21569.qmail@pb1.pair.com... > > > 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 > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php