MSQL Dynamic Menu/Best Way
Posted: Tue Dec 02, 2003 9:27 pm
This is what i have. It works. I was just wondering if there is a better way to do this.
Thanks for the comments and sugestions.
Code: Select all
function genSection()
{
$query = "SELECT * FROM section";
$result = dbquery($query);
$num_sections = mysql_num_rows($result);
for($i = 0; $i < $num_sections; $i++)
{
$menu_data = mysql_fetch_array($result);
echo "<p><b>$menu_dataїsection]</b></p>";
genSubSection($menu_dataїid]);
}
}
function genSubSection($id)
{
$query = "SELECT * FROM subsection WHERE id = '$id'";
$result = dbquery($query);
$num_subsections = mysql_num_rows($result);
for($i = 0; $i < $num_subsections; $i++)
{
$subsection_data = mysql_fetch_array($result);
echo "<p>$subsection_dataїsubsection]</p>";
}
}