I should explain what I am trying to do:
I want the navigation menu to display the pages that belong to a category on the that category page, and on a page that is in that category, the other pages must also show that also belong to that category.
Does that make sense? Anyway, here is my code, which might help explain what I am trying to do, I keep getting an error, and the pages do not show either.
<?php
$qry = 'SELECT * FROM categories WHERE hide = 1 ORDER BY sort';
$result = mysql_query($qry);
while($row = mysql_fetch_array($result)) {
$dbCatName = $row['name'];
$dbCatId = $row['id'];
if ($_GET['id']==$dbCatId) {
echo '> <a href="category.php?id="' . $dbCatId . '">' . $dbCatName . '</a><br>';
$pageQry = 'SELECT * FROM pages WHERE hide=1 AND category=$dbCatId ORDER BY sort';
$pageResult = mysql_query($pageQry);
while($pageRow = mysql_fetch_array($pageResult)) {
echo '<a href="page.php?id="' . $pageRow['id'] . '">' . $pageRow['name'] . '</a><br>';
}
} else {
echo '<a href="category.php?id="' . $dbCatId . '">' . $dbCatName . '</a><br>';
}
}
?>
The error is:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\cms-tutorial\templates\template-pages.php on line 32