when i do a search for ENGINE COWLING.. only the word COWLING gets bolded in the results which are displayed.. ( is the first word replaced with white spaces?) and if i search for ENGINE_COWLING, both the words do not get bolded.. how can i change the codes in order to get the words keyed in to be bolded? How can i allow multiple bolding?
// Get the search variable from URL
$var = @$_GET['document'] ;
//trim whitespace from the stored variable
$trimmed = trim($var);
//separate key-phrases into keywords
$trimmed_array = explode(" ",$trimmed);
/ Build SQL Query for each keyword entered
foreach ($trimmed_array as $trimm){
// EDIT HERE and specify your table and field names for the SQL query
if ($_GET["rb_select"] == "Title")
$query = "SELECT FROM Document WHERE Title LIKE \"%$trimm%\" ORDER BY Title DESC";
else
$query = "SELECT FROM Document WHERE DocNo like \"%$trimm%\" OR Title LIKE \"%$trimm%\"OR DocType like \"%$trimm%\" OR DocDescription like \"%$trimm%\" OR AircraftType like \"%$trimm%\" ORDER BY Title DESC" ;
$numresults=mysql_query ($query);
$row_num_links_main =mysql_num_rows ($numresults);
$row_num_links= mysql_num_rows ($num_value);
//now let's make the keywords bold. To do that we will use preg_replace function.
//Replace field
$Title = preg_replace ( "'($var)'si" , "<b>$trimm</b>" , $row_linkcat[ '1' ] );
$DocNo = preg_replace ( "'($var)'si" , "<b>$trimm</b>" , $row_linkcat[ '2' ] );
$DocType = preg_replace ( "'($var)'si" , "<b>$trimm</b>" , $row_linkcat[ '3' ] );
$DocDescription = preg_replace ( "'($var)'si" , "<b>$trimm</b>" , $row_linkcat[ '4' ] );