Why is this MySQL Join Statement not Working?
- by Timmy
Here is my code:
$query2 = mysql_query("SELECT * FROM categories WHERE parent = $id JOIN SELECT * FROM posts WHERE main_nav_page = '$idTwo'");
while ($row2 = mysql_fetch_assoc($query2)) {
$id = $row2['id'];
$name = $row2['name'];
$slug = $row2['slug'];
$subMenuOrder = $row2['sub_menu_order'];
echo "<tr>\n";
echo "<td> -- $name</td>\n";
echo "</tr>\n";
}
Is my syntax wrong?
EDIT:
the error message is:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/studentw/public_html/new_nav.php on line 30