1-0 = main1
1-1 = sub1
1-2 = sub2
2-0 = main2
2-1 = sub1
2-2 = sub2
//<-----------menu.inc--------->
require("config.inc");
$sql = "SELECT * FROM menu ORDER BY main, sub";
$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$main = $row['main'];
$sub = $row['sub'];
$url = $row['url'];
$text = $row['text'];
if ($sub == "0") { $html = "$text
";
}
else { $html = "$text
";
}
$menu_block .= "$html";
}
echo "$menu_block";
?>
//<----------- end menu.inc--------->
//<-------Table SQL------->
CREATE TABLE menu (
id int(11) NOT NULL auto_increment,
text text NOT NULL,
main int(4) NOT NULL,
sub int(4) NOT NULL,
url varchar(50) NOT NULL,
PRIMARY KEY (id)
);
//<-------End SQL------->