Kriol
Kriol

Reputation:

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.

Upvotes: 0

Views: 562

Answers (1)

David M
David M

Reputation: 72850

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

Upvotes: 6

Related Questions