I am trying to get a dynamic nav working and i am having a bit of trouble with the extraction of the information from the database.
the error is : Database query failed, Page Set error 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
<?php
include 'includes/header.php';
include 'includes/database.php';
?>
<table id="structure">
<tr>
<td id="navigation">
<ul class="subjects">
<?php
// Subject Extract
$subject_set = mysql_query("SELECT * FROM subjects",$connection);
if(!$subject_set){
die("Database query failed, Subject Set error");
}
while ($subject = mysql_fetch_array($subject_set)) {
echo "<li>{$subject["menu_name"]}</li>";
}
// Subject end
//Page Extract
$page_set = mysql_query("SELECT * FROM pages WHERE subject_id = {$subject["id"]}",$connection);
if(!$page_set){
die("Database query failed, Page Set error ". mysql_error());
}
echo "<ul class=\"pages\">";
while ($page = mysql_fetch_array($page_set)) {
echo "<li>{$page["menu_name"]}</li>";
}
// Page End
echo "</ul>";
?>
</ul>
</td>
<td id="page">
<h2>Content Menu</h2>
<p>Welcome to Opticalx CMS</p>
<ul>
<li><a href="content.php">Manage Website Content</a></li>
<li><a href="new_user.php">Add Staff User</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</td>
</tr>
</table>
<?php require ("includes/footer.php"); ?>