I have a database that contains multiple comments. Each comment has their own ID. I want to select 5 comments from the database, store the last comments ID into a variable and then select 5 more comments at a later time. When I collect 5 more comments at a later time I need them to have an ID larger than the previous comments ID that was stored in the variable. I will try to make a code so it is easier to understand.
$commentID = 0;
$query = "SELECT * FROM comments WHERE commentID > '$commentID' LIMIT 5";
I have not tried this code, I want to make sure this is the proper way of doing this before I test it and cant figure out the problem. But another question is if this does work, will it select the next 5 comments in order?
For example the commentID = 5 then will the query select comments with the ID's of 6,7,8,9,10?