$threads = mysql_query("SELECT DISTINCT t.id, t.title
FROM threads t LEFT JOIN comments c ON t.id = c.parentID
ORDER BY c.date DESC");
while ($thread = mysql_fetch_assoc($threads)) {
echo "<li><a href=\"?threadID=$thread[id]\">".htmlspecialchars($thread['title'])."</a></li>\n";
}
Can anyone see a problem in this code? It wont work as i want it. I want it the thread that was commented in latest on top, and the the next latest etc.
echo $thread[parentID] echoes nothing
comments:
id, comment, parentID, date