Jump to content

[SOLVED] MySQL query returns no results


bassdog65

Recommended Posts

Ok, I am new to PHP and MySQL, but I have a fairly good understanding of what I am doing, but clearly I am missing something.

 

First, here is what I running:

PHP version 5.2.2

MySQL version 5.0.45

 

I am setting up a basic forum like this, and my database structure looks like this:

5 tables, languages, posts, threads, users, words

posts stores the messages

threads stores the subjects

 

I have entries in every tables, and the PHP portion is fine, and I can enter threads into the forum, but when I go to check the messages, I keep getting no messages in the forum.

 

I ran a MySQL query in phpMyAdmin and it returns no rows, even though they are clearly there, so I think my MySQL syntax is wrong.  Here is the query I am trying to run:

 

SELECT t.subject, p.message, username, DATE_FORMAT( CONVERT_TZ( p.posted_ON,  'UTC',  'America/New_York' ) , '%e-%b-%y %l:%i %p' ) AS posted

FROM threads AS t

LEFT JOIN posts AS p

USING ( thread_id )

INNER JOIN users AS u ON p.user_id = u.user_id

WHERE t.thread_id =4

ORDER BY p.posted_on ASC

 

Every time I run it, it returns:

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0011 sec)

 

Clearly I am missing something, but I am new so I am not spotting my error with the joins.

 

Help please!

Link to comment
Share on other sites

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.