I am trying to make a list of categories with sub-categories. When I run the script I get
Database query failed:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1
so I added in
$rs = mysql_query($page_set) or die(“Problem with the query: $q at line " . LINE . ‘
’ . mysql_error());”
to debug the issue and it comes back with
“Problem with the query: at line 39 Query was empty”
Here is the script
[php]<?php
$subject_set=mysql_query(“select * from subjects”, $connect);
if(!$subject_set) {
die (“Database Query Failed:” . mysql_error());
}
while($page=mysql_fetch_array($subject_set))
{
echo "<li> {$page["menu_name"]}</li>";
}
$page_set= mysql_query ("SELECT * FROM pages where subject_id = " .$row['id'] , $connect);
$rs = mysql_query($page_set) or die("Problem with the query: $q at line " . __LINE__ . '<br>' . mysql_error());
if (!$page_set) {
die("Database query failed: " . mysql_error());
}
?>[/php]