I want to have a dynamic menu that feeds from a table using php and mysql.
My table looks like this:
sec_id sec_name sec_group
1 section 1 g
$qry_secs="SELECT DISTINCT sec_group FROM tbl_user_sec ORDER BY sec_id ASC";
$result_secs = mysql_query($qry_secs);
echo '\n';
//echo values
while($row_secs = mysql_fetch_assoc($result_secs)) {
echo '- '.$row_secs['sec_group'].'
\n';
echo '\n';
$newqry = "SELECT sec_name FROM tbl_user_sec WHERE `sec_group` = '" . mysql_real_escape_string($row_secs['sec_group'] . "'";
$result = mysql_query($newqry);
while($row = mysql_fetch_assoc($result) ) {
echo '- ' . $row['sec_name'] . '
\n';
echo '
\n';
}
echo '
\n';