Page 1 of 1

Search Results Help

Posted: Fri Jul 25, 2003 12:37 pm
by daniworldwide
I have a online horse sim game that I've been working on since Early June. I'm trying to figure out how to display search results. I have the wildcard already, but, some search results find more than 1,000 results. That would be a pain to load with slow Internet connections. I would like to select information from a database, and have 30 on a page.

Code: Select all

<?php
$result = mysql_query("SELECT hid, owner from horses WHERE name='%$horsename1%' limit 30") or die ('error on english reg');
$numresults = mysql_num_rows($result);

while ($row = mysql_fetch_array($result))
{
$hid = $row['hid'];
$owner = $row['owner'];

echo "<font color='white'><a href=horsepage.php?hid=$hid>$horsename1</a></b></u></i></font><br>";
}
?>
How would I make it, if numresults is above 30, have it so it refreshes that page, but shows the next 30 results?

Thanks,

:roll: Dani

Posted: Fri Jul 25, 2003 4:03 pm
by DuFF
Check out the pagination tutorial over at PHPfreaks.com. This will let you have a PREV | 1 | 2 | 3 | NEXT on the bottom of the page. After a little editing the tutorial is working great for me.

Thanks!

Posted: Fri Jul 25, 2003 4:24 pm
by daniworldwide
:D Thanks so much! I'll go check it out!

-Dani