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"])
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
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
'%
> 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
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
5 matches
Mail list logo