Is there any way to create next page automatically when there are more than 20 rows?
-
what do you mean with "next page"? do you have a code sample for us? – brainbowler Jul 24 '14 at 22:05
-
Bro i am Getting data from my mysqldatabase and i want when the data is more then 20 rows it will automatically create next page or view Next link so user can see more data – Hammad Jul 24 '14 at 22:05
-
if you aren't more precise, we won't be able to help. so, again: what do you mean with "next page"? – brainbowler Jul 24 '14 at 22:08
-
Bro Do u use Gmail ?? when u click on inbox all emails are come from database but when u click on next button then other 20 will show up – Hammad Jul 24 '14 at 22:10
-
http://stackoverflow.com/questions/3705318/simple-php-pagination – andrewsi Jul 24 '14 at 22:11
2 Answers
You will need to use a sql limit to limit the output for 20 rows, then a link at the bottom of the page to create a new page with a new limit of 21-41 and so on...
SELECT * FROM TABLE LIMIT 0, 20
That will output the first 20 lines, then you'll need to programatically do the following
SELECT * FROM TABLE LIMIT 21, 41
You will need to hold the variables in a PHP statement, and when the user presses the next page button, it will $_GET the variable from the header and add 20 to each of the numbers.

- 197
- 2
- 16
-
-
http://www.phpjabbers.com/php--mysql-select-data-and-split-on-pages-php25.html – James Simpson Jul 24 '14 at 22:15
If you want a frontend-side pagination only (and do not handle lots of data), have a look at this jQuery plugin:
This is easy to integrate and very useful!
If you are talking about a server-side pagination, see http://www.techumber.com/2012/08/simple-pagination-with-php-mysql.html. If you do not like that specific one, there are plenty of these tutorials out there.
The basic knowledge you need for the SQL side of things can be found here: http://www.petefreitag.com/item/451.cfm

- 667
- 5
- 17
-
-
-
http://www.phpgang.com/how-to-make-php-pagination_262.html IS this What i want ? – Hammad Jul 24 '14 at 22:20
-
-
-
you do not understand me. :) the question is how much data you have to handle. if it is a table with links of about <= 200 (would then be 20 pages), it can be handled using the jquery plugin i mentioned without the user getting a significant loading delay. – brainbowler Jul 24 '14 at 22:26
-
-
http://www.sanwebe.com/2013/03/ajax-pagination-with-jquery-php I get my work Done Thanks All – Hammad Jul 24 '14 at 22:39