How to organize the uploading of the records?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
In the implementation details I will not go, as interested in the algorithm for obtaining the records.

Imagine that in the database we have 100 records on the first page we get the first 10 records.
Begin to scroll down the page, click show more, loaded another 10 records.

All is well in this case, while we did not have the time to add records in the database for a while until we watched the first 10.

So, here we got the first 10 records[1,2,3,4,5,6,7,8,9,10]
scroll down, during this time, BD has added a couple of records [-1,0]
when getting the 2nd page of 10 records we would get [9,10,11,12,13,14,15,16,17,18] record
get doubles, the first two ( [-1,0] )is not displayed above, since we asked for the 2nd page.

Immediately comes to mind is check the array for duplicates, for example by ID records.
Okay, but what if in the DB in 1 second got 100 records?
2nd page we get [-90, -89, -88, -87, -86, -85, -8, -83, -82, -81] and when you come back to 0 again we get the double [1,2,3,4,5,6,7,8,9,10]

How can I deal with this problem?
by | 13 views

1 Answer

0 like 0 dislike
Usually do mark the time when they started flipping the tape and make selections from the database with the use of this label. We have taken the first sproc at 16:00 so we need to show the first 10 records from the tape, then someone adds something in 16:01 and we're in 16:02 click on the button to show 10 more. After that, the sample will go, so we chose the second pack of data which were until 16:00. And so the record which was in 16:01 I can't get anything going Apologet. And on the interface we can show(in VC for example), which is a new record.

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Apr 3, 2019 by Breeze1
0 like 0 dislike
1 answer
asked Mar 22, 2019 by deleted-mezhevikin
0 like 0 dislike
1 answer
asked May 12, 2019 by B1ackGh0st
110,608 questions
257,187 answers
40,796 users