tags:

views:

65

answers:

1
Q: 

Inner Join

$query4 = mysql_query("SELECT * FROM comments WHERE content_id = '$id' AND     content = 'thread'
                  INNER JOIN users ON comments.poster = users.id
               ORDER BY comments.date ASC");
while ($comment = mysql_fetch_array($query4)) {
}

all the tables and columns exist and i am connected to the database but it still gives me:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in thread.php on line 63

What am i doing wrong here?

Thanks in advance.

+6  A: 

Your join syntax is wrong. Try:

SELECT *
FROM comments
INNER JOIN users ON comments.pooster = users.id
WHERE comments.content_id = '$id'
ORDER BY comments.date ASC
David M
Works! Thank you :)