J
J
jrborisov2016-05-08 10:24:42
PHP
jrborisov, 2016-05-08 10:24:42

How to avoid duplicate content when uploading?

I have a table with news in my database. when the page is loaded, 10 posts are loaded, when scrolling to the bottom, the current page is transferred to the server and 10 more are loaded using (limit and offset). The problem is that if at the moment when the user was flipping through the feed and someone added a new post, the entries in the database will shift and the last entry will be duplicated.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
landergate, 2016-05-08
@jrborisov

  1. Hide duplicate news using JS, loading another +1 instead.
  2. Load news not by offset, but by < ID of loaded news (from the ID column).

S
Sanes, 2016-05-08
@Sanes

IMHO, not a big loss. Have not seen. so that someone bothers about this. You are not implementing chat.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question