Hello,
I have a web site that is basically a database of links for outdoor recreation releated web sites. I use php to provide the links in particular categories according to what the user selects. Currently, each category displays all links on a single page...that could be several hundred links. I'd like to display only, say, 25 links per page, with a link to the next 25, then the next 25, etc. Exactly the sort of thing that you see at Google.
But I'm stumped at how to do it.
Here's my current code to get the links:
<?php
$HTTP_GET_VARS['SubCat'];
$HTTP_GET_VARS['Location'];
$db = mysql_connect("xxxxx", "xxxxx", "xxxxx");
mysql_select_db("outdoors",$db);
if ($Location) {
$result = mysql_query("SELECT URL, SiteName, Description FROM backcountry WHERE SubCategory = '$SubCat' AND Location = '$Location' AND Status <> 'HIDDEN' ORDER BY SiteName",$db);
} else {
$result = mysql_query("SELECT URL, SiteName, Description FROM backcountry WHERE SubCategory = '$SubCat' AND Status <> 'HIDDEN' ORDER BY SiteName",$db);
}
?>
And to display the results:
<?php
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<LI><A HREF=\" %s \">%s</A> - \"%s\"\n", $myrow["URL"], $myrow["SiteName"], $myrow["Description"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>
Can somebody point me in the right direction on how to accomplish my dream of multiple pages of 25 (or however many I choose) links?
Thanks!
Mark