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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.