Does anyone have an alternate bit of code to use for pagination for search results? I have checked Rod's in the columns but it just seems so complex.........can anyone help me add some simple pagination to the following code?
Thanks so much.
Landy
<?
$sql = "SELECT * FROM products WHERE name LIKE'%' '$searchString%' or maincat LIKE'%' '$searchString%' or subcat1 LIKE'%' '$searchString%' or keywords LIKE'%' '$searchString%' ";
$result = @($sql, $dbconn);
if (!$sql) {
echo( "<P>Unable to execute query at this time.</P>" );
exit();
}
if (mysql_num_rows($result) == 0)
{
echo ("<table width=500 align=center border=0>");
echo ("<tr><td width=500 align=center><font face=verdana size=2 color=blue>We're sorry, but your search for <b>$searchString</b> returned 0 results.<br> Please try another search term.</td></tr>");
echo ("</table>");
}
else
{
$color = 0;
while ($row = mysql_fetch_array($result))
{
if ($color == 0) {
$color = 1;
$bgcolor = "#E3E8FE";
}
else
{
$color = 0;
$bgcolor = "#FFFFFF";
}
$name = $row['name'];
$description = $row['description'];
$uniqueid = $row['uniqueid'];
$prodid = $row['prodid'];
echo ("<table width=500 align=center cellpadding=6 border=0 bgcolor=$bgcolor>");
echo ("<tr><td width=35%><a href=productdetail.php?prodid=$prodid><font face=verdana size=1 color=blue>$name</font></a></td><td width=65% align=left><font face=verdana size=1 color=red>$description</font></td></tr>");
echo ("</table>");
}
}
?>