Eiolon Posted November 27, 2007 Share Posted November 27, 2007 I made a forum and it works for the most part. The problem I have is when I query for the list of topics in the forum, anything with 0 replies does not get shown. Once I have a reply to that topic it gets shown. Here is the query: SELECT t.*, r.*, DATE_FORMAT(t.topic_last_reply, '%c/%e/%Y %l:%i %p') AS convdate FROM topics t LEFT JOIN replies r ON (t.topic_id = r.reply_topic) WHERE t.topic_forum = ".$_GET['forum_id']." GROUP BY t.topic_subject HAVING t.topic_num_replies >= 0 ORDER BY t.topic_last_reply DESC Thanks! Quote Link to comment Share on other sites More sharing options...
fenway Posted November 27, 2007 Share Posted November 27, 2007 Two things: first, that's not the final query, echo the query as a string (after PHP variable interpolation). Second, remove the having clause, and check the value of your field. Quote Link to comment Share on other sites More sharing options...
Eiolon Posted November 27, 2007 Author Share Posted November 27, 2007 Sorry, I am a novice. When you mean variable interpolation, what do you mean? Like this? // Query the database for topic and reply information. $query_topics = "SELECT t.*, r.*, DATE_FORMAT(t.topic_last_reply, '%c/%e/%Y %l:%i %p') AS convdate FROM topics t LEFT JOIN replies r ON (t.topic_id = r.reply_topic) WHERE t.topic_forum = ".$_GET['forum_id']." GROUP BY t.topic_subject ORDER BY t.topic_last_reply DESC"; $topics = mysql_query($query_topics) OR die ('Cannot retrieve a list of topics.'); $row_topics = mysql_fetch_array($topics); Quote Link to comment Share on other sites More sharing options...
fenway Posted November 27, 2007 Share Posted November 27, 2007 I mean echo $query_topics. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.