require("db_class.php");
//$q = "SELECT menu_type, menu_subtype FROM menu";
$q = "SELECT DISTINCT menu_type, menu_subtype FROM menu";
$r = @mysqli_query ($dbc, $q);
$cart=array();
if ($r){
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC))
{
$cart[$row['menu_type']][$row['menu_subtype']][] = $row;
}
mysqli_free_result ($r);
}
print_r($cart);
gives me
Array
(
[INDENT] [Breads] => Array
[INDENT] (
[INDENT][] => Array
[INDENT] (
[INDENT][0] => Array
(
[INDENT][menu_type] => Breads
[menu_subtype] => [/INDENT][/INDENT]
)[/INDENT]
[/INDENT]
)[/INDENT]
)
[/INDENT]
[INDENT] [Salads] => Array
[INDENT] (
[INDENT] [] => Array
(
[INDENT] [0] => Array
(
[INDENT][menu_type] => Salads
[menu_subtype] =>[/INDENT] [/INDENT]
)[/INDENT]
)[/INDENT]
)[/INDENT]
[INDENT][Drinks] => Array
[INDENT] (
[INDENT] [Soft Drink] => Array
[INDENT] (
[0] => Array
(
[menu_type] => Drinks
[menu_subtype] => Soft Drink
)
)
[Tea] => Array
(
[0] => Array
(
[menu_type] => Drinks
[menu_subtype] => Tea
)
)
[Coffee] => Array
(
[0] => Array
(
[menu_type] => Drinks
[menu_subtype] => Coffee[/INDENT]
)[/INDENT]
)[/INDENT]
)[/INDENT]
)
this is the kinda thing i have been looking for thank you for the help with this problem but i have one more question, what would be the best way to call this information out of the array later on
i want to make links dynamically like the below using the multidimensional array
<a href='index.php?page=menu&ty=Breads'>Breads</a>
once again thank you for the help so far