Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/79131-query-not-retrieving-rows-with-0/
Share on other sites

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);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.