Reputation: 195
Here is my problem, so far I got this script:
$result = mysql_query(
"SELECT *
FROM $tableVideos
ORDER BY VideoTimestamp DESC
LIMIT 6"
) or die(mysql_error());
And that will make it so that I can show the 6 newest uploaded videos to my site.
But how can I have a limit of 6 and start from the 6th newest video and go up to the 12th? In that way I could show 6 videos and make a next button to show the next 6 videos.
Upvotes: 1
Views: 94
Reputation: 5588
Actually Limit function have two paramter :
one is limit of record and second is start from where.
result = mysql_query("SELECT * FROM $tableVideos ORDER
BY VideoTimestamp DESC LIMIT 6,6") or die(mysql_error());
Upvotes: 0
Reputation: 2047
Use this:
$result = mysql_query("SELECT * FROM $tableVideos ORDER BY VideoTimestamp DESC LIMIT 6,6") or die(mysql_error());
Upvotes: 0
Reputation: 174957
You want
LIMIT 6,6
Meaning "Start with the 6th entry, and give me 6 more".
Upvotes: 4
Reputation: 17336
You currently have LIMIT 6
to get the first 6 results. If you use
LIMIT a,b
then you will get b
items starting from the a
th.
Upvotes: 5