I have a script where members login and read posts by catagory that I have in Table called posts, then they click a button and an entry is inserted into Table called postsread collecting the postname, their memberid, and the date showing that it had been read by them. What I am looking for is a query that will display to them only the posts that they have not already read.
**Tables** **Fields** posts id, name, date, from, topic, info, cat postsread id, postname, memberid, date users id, memberid, pass, fname, lname, email
Sessions is already holding their $_SESSION['memberid'], but am unsure of how to query between the two tables to get what I'm looking for. It would be like: Show all posts in Posts except those in Postsread with the members memberid next to the corresponding postname. I am using php version 5.3, and mysql 5.0.96.
I am using the following to display posts from database:
$sql=mysql_query("SELECT * FROM posts WHERE cat='1' ORDER BY date DESC");
But this does not differentiate between if the member has clicked stating they have seen them yet or not.
I have looked many places and see examples that are close but just cant get any to fit what I am needing. I don't fully understand how to write this. I have tried many with no success. If you need extra description please ask. Thank you for your time.