Try:
<?php include("rheader.php"); ?>
<?php
$letter = $_REQUEST['letter'];
$numeric = $_REQUEST['numeric'];
if ($letter) {
$sql = "select drinkid, title, date, rating from drinks where title like '".$letter."%' and status = 'L'";
} else {
$sql = "select drinkid, title, date, rating from drinks where categoryid = '".$catid."' and status = 'L'";
}
if ($numeric == "all") {
$sql = "select drinkid, title, date, rating from drinks where title REGEXP '^[1234567890]' and status = 'L'";
}
$result = mysql_query($sql ,$db);
$numrows = mysql_numrows($result);
$lastpage = false;
if ($pagenum == 0) {
$startrow = 0;
} else {
$startrow = 25 * $pagenum;
}
if ($numrows < $startrow + 25) {
$endrow = $numrows;
$lastpage = true;
}
if ($letter) {
$sql = "select drinkid, title, date, rating from drinks where title like '$letter%' and status = 'L' order by title limit $startrow,25";
$pagetitle = "Drinks starting in the letter '$letter'";
} else {
$sql = "select * from categories where categoryid = $catid";
$result = mysql_query($sql ,$db);
$row = mysql_fetch_row($result);
$pagetitle = $row[1];
$sql = "select drinkid, title, date, rating from drinks where categoryid = $catid and status = 'L' order by title limit $startrow,25";
}
if ($numeric == "all") {
$sql = "select drinkid, title, date, rating from drinks where title REGEXP '^[1234567890]' and status = 'L' order by title limit $startrow,25";
$pagetitle = "Drinks starting in numbers";
}
?>
<TD VALIGN=top width="60%" BGCOLOR="FFFFFF">
<TABLE BORDER=0 WIDTH=99% ALIGN=CENTER>
<TR>
<TD VALIGN=top>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% BGCOLOR=000000>
<TR><TD align=center><FONT SIZE=2 FACE="Verdana,arial,helvetica" color=white><B><?php printf($pagetitle); ?></B></FONT></TD></tR>
</TABLE>
<FONT SIZE=2>
<center>
<br>
<table cellspacing=0 cellpadding=2 border=0>
<tr>
<th width=300 bgcolor=#CCCCCC align=center><FONT face=arial size=2>Drink</font></th>
<th width=85 bgcolor=#CCCCCC align=center><FONT face=arial size=2>Date Added</font></th>
<th width=75 bgcolor=#CCCCCC align=center><FONT face=arial size=2>Rating</font></th>
</tr>
<?php
$rowcolor = 1;
$result = mysql_query($sql ,$db);
if ($myrow = mysql_fetch_array($result)) {
do {
if ($rowcolor == 1) {
$rowcolorhex = "#ffffff";
$rowcolor = 0;
} else {
$rowcolorhex = "#EDEAB9";
$rowcolor = 1;
}
printf("<tr>");
printf("<td width=300 bgcolor=%s align=center><FONT face=arial size=2><a href=drink.php?drinkid=%s>%s</a></font></td>", $rowcolorhex, $myrow["drinkid"], $myrow["title"]);
printf("<td width=80 bgcolor=%s align=center><FONT face=arial size=2>%s</font></td>", $rowcolorhex, $myrow["date"]);
printf("<td width=75 bgcolor=%s><table bgcolor=%s border=0 cellspacing=0 cellpadding=0><tr>", $rowcolorhex, $rowcolorhex);
$onstars = round($myrow["rating"]);
$offstars = 5 - $onstars;
for ($i = 1; $i <= $onstars; $i++) {
printf("<td width=15 bgcolor=%s align=center valign=center><FONT face=arial size=2><img src=images/staron2.gif></font></td>", $rowcolorhex);
}
for ($f = 1; $f <= $offstars; $f++) {
printf("<td width=15 bgcolor=%s align=center valign=center><FONT face=arial size=2><img src=images/staroff2.gif></font></td>", $rowcolorhex);
}
printf("</tr></table></td>");
printf("</tr>");
} while ($myrow = mysql_fetch_array($result));
}
printf("<tr>");
if ($startrow > 0) {
printf("<td align=left><FONT face=arial size=2><a href=category.php?pagenum=%s&searchingred=%s&catid=%s&letter=%s>Previous Page</a></font></td>", $pagenum-1, $searchingred, $catid, $letter);
} else {
printf("<td> </td>");
}
printf("<td> </td>");
if ($lastpage == false) {
printf("<td align=left><FONT face=arial size=2><a href=category.php?pagenum=%s&searchingred=%s&catid=%s&letter=%s>Next Page</a></font></td>", $pagenum+1, $searchingred, $catid, $letter);
} else {
printf("<td> </td>");
}
printf("</tr>");
?>
</table>
</center>
</FONT>
</TD></TR></TABLE>
</TD>
<?php include("rfooter.php"); ?>