show mysql-search-result in steps of 10

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mazzogeddon
Forum Newbie
Posts: 7
Joined: Thu Aug 01, 2002 7:23 am
Location: Berlin

show mysql-search-result in steps of 10

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
rev
Forum Commoner
Posts: 52
Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA

Post by rev »

Do it within SQL... something like:

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

That will display records 81-90.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post 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
Post Reply