Re: build menu with mysql data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Rite marc,
this is what your gonna have to do, in a new table like this lets say we call it "MAINSUB"

MAINMENU ID
SUBMENU ID

it only contains those 2 fields to show that there is a link between the two okay?

now to the actual menu

<<use a for loop like this
for($x=2, $x < 4, $x++
<<Your gonna use a query
SELECT * FROM MAINSUB WHERE MAINMENU ID = '$x'
<<The result of this will be all the items that come under Downloads stored in an array now just split the array up and get their seperate ID numbers and print them

I've not explained it FULLY cos it's always better to work the most part of a problem out yourself... if ya have any more questions email me

Dave

From: "Marc Bleuler" <marc@bleuler.net>
To: php-db@lists.php.net, php-general@lists.php.net
Subject: build menu with mysql data
Date: Tue, 21 Jan 2003 18:31:15 +0100

Hi,

I would like to bild a tree menu with mySQL data. where I have the collapsed
main menue and when I click the link the specific submenue expands (as
follow).

(collapsed Main Menu)
+ Home
+ Downloads
+ About me
+ Search

....and for example if I click the "Download" section it will look as
follow....

(expanded Main-Sub Menu)
+ Home
+ Downloads
- Music
- Programm
+ About me
+ Search

....and the SQL Tables...

MAINMENUE_TABLE
ID NAME
-----------------------------
| 1 | Home |
| 2 | Downloads |
| 3 | About me |
| 4 | Search |

....and....

SUBMENUE_TABLE
ID MAIN_ID NAME URL
-------------------------------------------------------------------
| 1 | 2 | Music |
./somefile.php?action=music
| 2 | 2 | Programm |
./somefile.php?action=programm
| 3 | 3 | Pictures |
./somefile.php?action=pictures
| 4 | 3 | Address |
./somefile.php?action=address
| 5 | 4 | My Page |
./somefile.php?action=mypage
| 6 | 4 | The Web |
./somefile.php?action=theweb
| 7 | 4 | Google |
./somefile.php?action=google


If I'm using a while loop it won't work, so I realy don't have and more
ideas...
Please consider in your explanations I'm a PHP beginner... :-)

thanks
Marc



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux