Code: Select all
<?php
$sql="SELECT *
FROM tblRestaurant r, tblRestaurantFeatures f, tblCuisine c, tblType t
WHERE r.restID = f.restID && restName = '$_POSTїrestName]' && f.primaryCuisine = c.cuisineID && f.primaryType = t.typeID order by restName";
$result=mysql_query($sql,$conn)or die(mysql_error());
$num=mysql_num_rows($result);
if ($num<1){
print"We have no records of a restaurant named $_POSTїrestName].<br>
Perhaps you would like to search by First Letter Of the Restaurant:
<form name="alpha" method="post" action="results_page.php">
<select name="alpha">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="G">G</option>
<option value="H">H</option>
<option value="I">I</option>
<option value="J">J</option>
<option value="K">K</option>
<option value="L">L</option>
<option value="M">M</option>
<option value="N">N</option>
<option value="O">O</option>
<option value="P">P</option>
<option value="Q">Q</option>
<option value="R">R</option>
<option value="S">S</option>
<option value="T">T</option>
<option value="U">U</option>
<option value="V">V</option>
<option value="W">W</option>
<option value="X">X</option>
<option value="Y">Y</option>
<option value="Z">Z</option>
</select>
<input type="hidden" name="searchValue" value="searchAlph">
<input type="submit" name="submit" value="Search By Letter">
</form>
";}
else if($num>=1)
{
$row=mysql_fetch_array($result);
$restID=$rowї'restID'];
$restName=$rowї'restName'];
$restAddress=$rowї'restAddress'];
$restCity=$rowї'restCity'];
$restState=$rowї'restState'];
$restZip=$rowї'restZip'];
$restPhone=$rowї'restPhone'];
$restFax=$rowї'restFax'];
$restURL=$rowї'restURL'];
$restDescription=$rowї'restDescription'];
$deliveryRadius=$rowї'deliveryRadius'];
$deliveryTimeBegin=$rowї'deliveryTimeBegin'];
$deliveryTimeEnd=$rowї'deliveryTimeEnd'];
if ($deliveryTimeBegin!="") {
$delivery="Delivery:$deliveryTimeBegin - $deliveryTimeEnd";}
else {$delivery="";}
$primaryCuisine=$rowї'primaryCuisine'];
$primaryType=$rowї'primaryType'];
$cuisineName=$rowї'cuisineName'];
$typeName=$rowї'typeName'];
if ($restURL!=""){
$link="<a href="$restWeb"><img src="/images/button_website.jpg" width="60" height="19" border="0"></a>";
} else { $link="";}
if ($restFax!="") {
$fax="F: <em>$restFax</em>";
$menulink=urlencode("$restID");
} else { $fax="";}
print "<table width="460" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="ffffff">
<td colspan="2" height="20"><div align="left"><span class="style2">
<a name="$restName"></a><b>$restName</b></span></div></td>
<td height="20" width="140" valign="top"><A HREF="menu_page.php?restID=$restID">See menu</A></td>
</tr>
<tr>
<td width="165" height="15" valign="top"><span class="style2">$restAddress</span></td>
<td width="155" valign="top"><span class="style2">P:$restPhone</span></td>
<td width="140" rowspan="4" valign="top"></td>
</tr>
<tr>
<td width="165" height="15"><span class="style2">$restCity $restState $restZip</span></td>
<td width="155" height="15"><span class="style2">$fax</span></td>
</tr>
<tr>
<td width="165" height="15"><span class="style2">$typeName</span></td>
<td width="155" height="15" valign="top"><span class="style2">$cuisineName Cuisine</span></td>
</tr>
<tr>
<td width="165" height="15"><span class="style2">$delivery</span></td>
<td width="155" height="15"valign="top"></td>
</tr>
<tr><td height="15" colspan="3" valign="top"><span class="style2">$restHours</span></td></tr>
</table>";
?>