i'm trying to make my own pagination system ignores the new data if someone trying to open the next page:
example:
i have this table :
1. apple
2. orange
3. banana
4. burger
5. pizza
6. spaghetti
and i only show 3 rows for each page.
mysql query:
// $page = 0 for first page
$sql = "SELECT * FROM mytable ORDER BY id DESC LIMIT $page, 3";
the result is like this
page #1 :
6. spaghetti
5. pizza
4. burger
page #2 :
3. banana
2. orange
1. apple
let's say right now I'm in page #1 and someone else added 3 new rows:
water
juice
coffee
what will happen now is if i go to page #2 i will get a repeated page !
now page #2 is gonna be :
6. spaghetti
5. pizza
4. burger
the reason of that is because page #1 is showing the new data:
9. water
8. juice
7. coffee
how can i stop this to happen if the user didn't refresh the first page and only wanted to view the second page ?
it's a problem especially if you're trying to make your pagination looks just like twitter!