Page 1 of 1

show mysql-search-result in steps of 10

Posted: Mon Oct 14, 2002 5:08 am
by mazzogeddon
Hi@all

I have a mySQL Database which i use with PHP. If I have a search result, I want to show it by steps of 10 (like in google). Right now, I use

for(i=0; i<$result; i++){
echo "resultset";
}
which shows all results at once.

thx for help!
mazzo

Posted: Mon Oct 14, 2002 5:11 am
by twigletmac
Try searching on this forum for 'previous AND next' this is a fairly popular question so there's lots of stuff on it.

Mac

Posted: Mon Oct 14, 2002 10:47 am
by rev
Do it within SQL... something like:

Table with 100 records:
SELECT * FROM tableName LIMIT 80,10;

That will display records 81-90.

Posted: Mon Oct 14, 2002 5:02 pm
by hob_goblin
If you have the user click "next" or "prev" or something like that, make sure you check if the user input is an integer

http://www.php.net/manual/en/function.ctype-digit.php
http://www.php.net/is_int

etc