Say I have 50 rows in a MySQL table. I want to select the first ten (LIMIT 10
), but then I want to be able to select the next 10 on a different page.
So how do I start my selection, after row 10?
Updated query:
mysql_query("
SELECT * FROM `picdb`
WHERE `username` = '$username'
ORDER BY `picid` DESC
LIMIT '$start','$count'
")
From the MySQL 5.1 docs on
SELECT
syntax:and continue till the numbers you want.
I recommend working by obtaining the first page using:
then for the second page
then
for the third page, and so on.
This question is old but i just want to add a code that is not hardcoded, the answer chaos gave means you'll have to hardcode your scripts(Select statement). you can achieve the same results by getting the file name and then select data from the database based on the current page, without hardcoding your select statement. first get the current page