Hello world,
for a 'simple' photo website, and to learn a bit about php and mysql, i have two tables :
menu
- title // jan, feb, march
- menu_id
sub_menu
- title //photo1, photo2, photo3
- menu_id
- photo_url
the idea is that when a user clicks on one of the HREF main menu links at the top, then the site displays the submenu titles on the left and also photo1 (first in the array) in the middle.
I'm having problem working out how to dynamically generate the php variables in the HREF main menu links...
In the loop where the main_menu_title are echo'd, I need to work out '$first_sub_menu_title (see code) as part of the while loop...
Am looking thru the tutorials, but can't work out what method I should be using......appreciate any direction
$main_menu_query = @('SELECT sub_menu_id, title from sub_menu');
while ($main_menu_array = mysql_fetch_array($main_menu_query))
{
$main_menu_title = $main_menu_array ["title"];
$main_menu_id = $main_menu_array ["main_menu_id"];
echo '<a href=index.php?title='.$first_sub_menu_title.'&main_menu='.$main_menu_id.'>'.$main_menu_title.'</a> |';
}