Page 1 of 1

how to show fetch array number of results?

Posted: Sat Jul 03, 2010 8:18 pm
by fael097
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!

Re: how to show fetch array number of results?

Posted: Sat Jul 03, 2010 8:37 pm
by AbraCadaver
Search this forum for 'pagination'. There are many threads with great examples.

Re: how to show fetch array number of results?

Posted: Sun Jul 04, 2010 12:33 am
by fael097
thanks, but my pagination is done, i just need to retrieve this number

Re: how to show fetch array number of results?

Posted: Sun Jul 04, 2010 2:04 am
by jraede
If you're doing the pagination with a LIMIT clause in your SQL query, you're going to have to do a separate query first to get the number of rows. You can do that by using mysql_num_rows($result).