I use the following select to grab the items already seen:
$sql = $conn->query("SELECT * FROM views b, news a WHERE a.status = 'true' AND a.id = b.id_news AND b.ip = '$ip' ORDER BY a.id DESC LIMIT 6");
Where: $ip = $_SERVER['REMOTE_ADDR'];
.
Table Structures:
-
views
id | id_news | ip
-
news
id | title | text | status
I want to get a select all the unseen news, ie if I did not see it, it does not have my ip related to the id of a news.
I always feed the table views when a user enters the news, there is inserted the news id and the user's ip.
How can I make this select to pick only unseen news? I hope it has become clear.