I'm trying to display @mentions for my currently logged in user but I'm getting a syntax error and I don't know what it is. My database is mysql and my query currently looks like this:
$sql = "SELECT
users.username,
posts.post,
posts.time_stamp,
FROM users
INNER JOIN posts
ON users.id = posts.user_id
INNER JOIN mentions
ON users.id = mentions.user_id
WHERE mentions.user_id = '$userid'
AND mentions.unread = 1
ORDER BY time_stamp DESC
";
What I want to happen is for the currently logged in user to go to a page called "mentions" and to get a list of the posts they were mentioned in and the username who mentioned them BUT ONLY if the mention is unread (i.e. is equal to 1) because later on that same page I will then change the displayed mentions 'unread' status to 0, which means it has been read.
I hope this makes sense! If you need more info on the db structure etc, shoot a comment and I will give you more info.