MySQL Forums
Forum List  »  Quality Assurance

Re: php mysql pagination
Posted by: d batz
Date: November 23, 2011 01:30AM

I've done that before. Usually i do a combination of code.

1st, simple sql query:

SELECT * FROM tb1 ;

then forward it to mysql_num_rows() in php... I don't apply limit yet.
No fetch has been done. I use this to serve me to get all TOTAL rows and divide (number of rows per page),
That's where i get the TOTAL_PAGES. Navigation is to you your LEFT and RIGHT is up to you php algo techniques.


2nd, simple sql query + append the limit

SELECT * FROM tb1 LIMIT 0 , 20;
for page 1
assume you have 20 rows per age. the rest is up to you how to hit those numbers.
Page 1 should always start with 0.

Options: ReplyQuote


Subject
Views
Written By
Posted
4833
November 12, 2011 01:01PM
Re: php mysql pagination
1529
November 23, 2011 01:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.