Re: [PHP] highlighting Search Results

2002-05-06 Thread Justin French
If you want to highlight the EXACT search string, do a str_replace() on $row["Description"], $row["ProductName"], etc etc, replacing the search phrase with $searchSite. Pretty simple. $siteSearch", $row["Description"]); $productName = str_replace($siteSearch, "$siteSearch", $row["ProductName"])

[PHP] highlighting Search Results

2002-05-06 Thread DC
Hi all, I have a mySQL database running with PHP4. I have constructed a search form ($searchSite) which returns results in a results page & now I want to have the word that was entered in the search form highlight in the results page. eg User enters a search for products using the word " gardeni

RE: [PHP] highlighting search results (revisited)

2001-04-18 Thread Matt Williams
Hi James I'll paste the code I use.. $string = search string entered in the text box. # // REPLACE SPACES FOR MULTIWORD SEARCH $string = str_replace(" ","%",$string); $db->query("SELECT title,description FROM files WHERE (title LIKE '%

FW: RE: [PHP] highlighting search results (revisited)

2001-04-18 Thread Matt Williams
> The input from the search form is $searchtext. The Returned > Search data is > $searchdata. > > > $sql = "SELECT searchdata FROM table WHERE searchdata LIKE > '%$searchtext'"; > $result = @mysql_query($sql, $connection) > or die (mysql_error()); > > $num = mysql_num_rows($result); > > $x

[PHP] highlighting search results (revisited)

2001-04-17 Thread Matt Williams
I am trying to write a little search script to search a mysql db. I would like to highlight the search words for the displayed results, like sourceforge etc... After a little help, I have got it to hightlight when searching for one word. The problem is if I do a search for more than one word it