When you read a thread, the time, your username and the id of the thread are inserted into a table called f_read, or updated if you have read the thread before. In the f_threads table, there's a column called lastpost, which stores the time of the last post in the thread. When you view a forum, all the threads in that forum whose lastpost > the time you read them should be selected and marked with a star.
This is the query I use for selecting them:
Code: Select all
<?php
$sqlNEW = "SELECT f_threads.id FROM f_threads LEFT OUTER JOIN f_read ON f_threads.id = f_read.thread AND f_read.user = '".$_COOKIE['user']."' WHERE ((f_threads.lastpost > f_read.time) OR f_read.time = NULL) AND forum = ".$_GET['id']." AND (f_threads.lastpost > '".$rowU['forumsince']."')";
?>The problem with this query is that it selects all the threads in the forum. I have no idea what is wrong.
Does anyone know?