I would like to thank everyone for their help..I have added tables and have sorted records such as 1 2 3 next....but I am having problems with the limit function. Currently, I set my limit to 5 records per page, however, if I donm't have 5 records to display I get a parse error on the last line of my html...it always points to </body> tag...How can I fix the limit function to not display parse errors if I don't have enough records to display per query?

thanks..

<?PHP
$PAGE = (isset($page)) ? $page : 1; #We hope that page, not PAGE is in the querystring,
#if not we set it here
$dbhost = "xxxxx"; # These are fairly self explanatory....
$dbname = "xxxxx"; # You can remove these if you've already connected to a DB...
$dbuser = "xxxxx";
$dbpass = "xxxxx";

$db = mysql_connect($dbhost,$dbuser,$dbpass); #Use $dc for debugging.
mysql_select_db($dbname,$db); # Connect now, forget about it later.




$sql = "SELECT Business_Name, Business_Description, Address_1, E_Mail, Web_Site, Business_Logo, Category, Subcategory, Visible, Phone_Number, Contact_Name, City, Zipcode, Neighborhood FROM Business
Where Category = 'Bars & Clubs' and Subcategory = 'Bears & Leather' and Visible = 'Y'
ORDER BY Business_Name ASC";

$limit = 5; // rows to return
$numresults = mysql_query($sql, $db);
$numrows = mysql_num_rows($numresults);

// next determine if page has been passed to script, if not use 1
if (empty($page)) {
$page = 1;
}

$offset = $limit * ($page - 1);

// get results
$result = mysql_query("$sql limit $offset,$limit");

// now you can display the results returned
while ($row = mysql_fetch_array($result)) {

printf('<tr bgcolor="8CA7C7"><td colspan=2><b>%s</b></td></tr>', $row["Business_Name"]);
if ($row["Address_1"] != "")
printf('<tr bgcolor="F3F3F3"><td>Address</td><td>%s</td></tr>', $row["Address_1"]);
if ($row["City"] != "")
printf('<tr bgcolor="F3F3F3"><td>City</td><td>%s</td></tr>', $row["City"]);
if ($row["Neighborhood"] != "")
printf('<tr bgcolor="F3F3F3"><td>Neighborhood</td><td>%s</td></tr>', $row["Neighborhood"]);
if ($row["Phone_Number"] != "")
printf('<tr bgcolor="F3F3F3"><td>Phone</td><td>%s</td></tr>', $row["Phone_Number"]);
if ($row["E_Mail"] != "")
printf('<tr bgcolor="F3F3F3"><td>E-Mail</td><td><A HREF="mailto:%s">%s</a></td></tr>', $row["E_Mail"], $row["E_Mail"]);
if ($row["Web_Site"] != "")
printf('<tr bgcolor="F3F3F3"><td>Web Site</td><td><A target="_blank" HREF="%s">%s</a></td></tr>', $row["Web_Site"], $row["Web_Site"]);

if ($row["Business_Description"] != "")
printf('<tr bgcolor="F3F3F3"><td colspan=2>%s</td></tr>', $row["Business_Description"]);
printf('<tr bgcolor="F3F3F3"><td colspan=2>&nbsp;</td></tr>');


// include code to display results as you see fit


// next we need to do the links to other results

if ($page > 1) { // bypass PREV link if offset is 0
$refpage = $page - 1;
print "<a href='$PHP_SELF?page=$regpage'><img src='prev.gif' border='0'>&nbsp;PREV</a> &nbsp; \n";
}

// calculate number of pages needing links
$numpages = intval($numrows / $limit);

// $numpages now contains int of pages needed unless there is a remainder from division
if ($numrows % $limit) {
// has remainder so add one page
$numpages++;
}

for ($i = 1; $i <= $numpages; $i++) { // loop thru
if($page != $i) {
print "<a href='$PHP_SELF?page=$i'>";
}
print $i;
if($page != $i) {
print "</a>";
}
print "&nbsp; \n";
}

// check to see if last page
if ($page < $numpages) {
// not last page so give NEXT link
$refpage = $page + 1;
print "<a href='$PHP_SELF?page=$refpage'><img src='next.gif' border='0'>&nbsp;NEXT</a><p>\n";
}

?>