Jump to content

how to show fetch array number of results?


fael097

Recommended Posts

hi, i have like 93 entries on a database table, divided to show 20 per page, but i wanted to display something like "showing results 1 to 20" on each page, and on the last page, it would display "showing results 81 to 93".

to get the first number, i use the same variable that i use to define where the page starts, but i dont know how to get the last entry that is being displayed. any clues?

thanks in advance!

Coming up with the to x value is rather straight-forward, simply take the starting number and add the mysql_num_rows() value to it.

 

On full pages, where you queried for 20 results, mysql_num_rows() will be 20. On the last page, mysql_num_rows() will be just the number that was actually retrieved.

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.