Q:

Separate Items of an Array Over Different Pages

Possible Duplicate:
php sample script for pagination 

Suppose after a Process, My MySQL Table Returns an array into some variable. The array containts title and content of various posts/articles.
I want to show only 5 items of that array on the homepage. And the user would have to click on next page or page 2, to get to the next 5 items.
How do i do that kind of thing in PHP ?
Each Post of mine has an ID column in the Databases, which uses Auto_increment. So, the laest post would have largest value of ID.

A:

SELECT id FROM table 
ORDER BY id DESC
LIMIT 5 OFFSET 0

you can change order by ASC too, while click on next, pass offset value as 5, and each subsequent click add offset + 5   

