Jump to content

Previous | Next pages


jaymc

Recommended Posts

For webpages that display rows of data from a source of 100 etcs, what is the best way to determine if you are currently on the last page

 

For inststance, if there is 100 rows in a database, but we only display 10 per page, the first page will give us 10 rows and a link to

page 2 (11-20)

 

But, what is the best way to determine if there is more information, thus, display a next page link

 

The way I can think of is making the mysql query have a LIMIT 0,11, then in the while loop pull all the rows out until it hits 10, that way you only get 10 rows of data but can use mysql_num_rows to see if the query returned 11 rows, if it did, then theres obviously more data thus display a next page link

 

I dont really like doing this as Im having to pull out the extra row for nothing, but thinking about it Im not sure there is any other way, thats optimized

 

How do you all go about this? Is it using my method above and is that the coding standard

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/97253-previous-next-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.