My A table stored all update of my web and V table stored which update viewed by user.
Now I want to create a SELECT statement that not fetch table A's which id's date that id's of table V user_id=session id.
Case 1: To fetch all data from table A I used:
$id = 5, 10, 15; (for example)
$j = mysqli_query($dbh,"SELECT * FROM A WHERE `id`='".$id."' ORDER BY date DESC");
Case 2: Now select all ids where user_id = session id {If found any id reduce from case 1 fetch}
$myid = 50; ($session->id)
$p = mysqli_query($dbh,"SELECT post_id FROM V WHERE `post_id`='".$id."' AND `user_id` ='".$myid."'")
Table A:
id | from_id | to_id | date
---------------------------
5 |
10 |
15 |
20 |
Table V:
post_id | user_id
-----------------
5 | 45
15 | 50 (see: this is my id)
From above example I want fetch only ids 5 , 10 data where 15 reduce for match user_id = session id.