Still having trouble putting it into action.. Below is the code I am using.
<?
mysql_select_db($selectdb);
$query1 = "SELECT recordid, company, address, city, state, zip, phone, map, email, cuisine1, cuisine2 FROM restaurants ";
if($cuisine != "Display All")
{
$wherecuisine = "(cuisine1 LIKE '%$cuisine%' OR cuisine2 LIKE '%$cuisine%') ";
}
if($location != "Display All")
{
$wherelocation = "(location LIKE '%$location%' OR city LIKE '%$location%' OR area LIKE '%$location%') ";
}
if($wherecuisine || $wherelocation)
$query1 .= "where ";
if($wherecuisine)
$query1 .= $wherecuisine;
if($wherecuisine && $wherelocation)
$query1 .= "and ".$wherelocation;
if(!$wherecuisine && $wherelocation)
$query1 .= $wherelocation;
$query1 .= "limit $offset,$limit";
$query_results = mysql_db_query("$selectdb","$query1");
echo "<table width=100% border=0 cellspacing=0 cellpadding=3>\n";
echo "<tr>\n";
if ($row = mysql_fetch_array($result)) {
while($row = mysql_fetch_object($query_results))
{
printf("<td class=reg><span class=busname><A HREF=\"details.php?recordid=$row->recordid\">$row->company</A></span> -- (%s%s)</td></tr><tr><td class=reg>%s %s, %s %s %s</td></tr><tr><td class=listing><a href=\"$row->map\" target=\"_blank\">Map</a> | <a href=\"mailto:$row->email\">Email</A></td></tr><tr><td><hr></td></tr>\n",
$row->cuisine1, $row->cuisine2, $row->address, $row->city, $row->state, $row->zip, $row->phone);
}
} else printf("<td class=reg><font face=Verdana, Arial, Helvetica, sans-serif size=2>Sorry, no results were found! - <a href=dining.php>Start a new search</a></font></td>");
echo "<tr>\n";
echo "<td class=reg>\n";
?>