Hi Andy,

In answer to part two - here's a snippet of code I use to highlight relevant
words in red - hope it helps to put you on the right track.

for ($i=0; $i < count($keywords); $i++) {
    $blurb = eregi_replace(" ".$keywords[$i]." ", " <font
color=\"#FF0000\">".$keywords[$i]."</font> ", $blurb);
}

where $keywords is an array containing all the words searched for and $blurb
is the snippet that is returned with the search results At this stage in the
flow, I've already retrieved relevant records - this is in fact the last
step before I format and display the results..

Hope this helps

stuart


----- Original Message -----
From: "andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 25, 2002 9:32 PM
Subject: [PHP-DB] full text search and how to underline keyword in results


> Hi there,
>
> I am trying to write a php script to perform a full text search on a mysql
> db. I do a match against... and it digs out some results out of the db.
>
> There are 2 problems:
>
> 1. How can I restrict the results to e.g. 100 characters, but to make sure
> the keyword is within this 100 characters?
> 2. Is it possible with php to underline the keyword inside the search
> results. This might be more tricky.
>
> Thank you for any help on that,
>
> Andy
>
>
>
> --
> 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

Reply via email to