limit number to 5 records and display page number to move to more

hi all im working on a feedback (blog) page i know how to get info from database and limit to 5 but how do i get it to calculate pages and give the ability to see the next 5 or previous 5 records im using mysql and php

What you looking for is called pagination. There are good pagination tutorial just google search and you will find

Here is a good example

http://www.web-max.ca/PHP/misc_1.php

It’s quite easy. The “LIMIT” clause in MySQL queries allow for a starting number and a count.

So, you can code a variable, let’s say $start.

Set the variable $start = 0

Query using LIMIT $start, 5 (Currently pulling first five rows of data)

Then, increment the starting point as needed, $start=$start+5;

Hope that is what you are looking for…

thaks guys just what i wanted

Glad to help! I will mark this post solved…

Sponsor our Newsletter | Privacy Policy | Terms of Service