Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Database Menu into array

1:51 am on Feb 21, 2010 (gmt 0)

5+ Year Member

Hi all,

I am currently trying to further my website-forum integration by recreating the menu(generated from the database) in my forums.

To do this, I am trying to put all the menus and submenus into an array. The tricky part is getting the submenus into the array, which I am lost with.

To make things clearer, here is an image with some of the rows:

So I need to get the menus into an array(using a query similar to the one in the image), with similar levels. The parent field determines their levels. However, I also need to store the ID for each menu. I'd like the array to display something like this:

Sorry if this post is confusing,

Thanks in advance,

[edited by: eelixduppy at 1:56 am (utc) on Feb 21, 2010]
[edit reason] removed url [/edit]

3:04 am on Feb 21, 2010 (gmt 0)

5+ Year Member

Sorry for the double post, the edit is not working.

It seems a mod removed my image. The table structure is as follows

id| name| parent|
1 Menu 1 0
2 Menu 2 0
3 Menu 3 0
4 Menu 4 1
5 Menu 5 1
6 Menu 6 4
7 Menu 7 4 <-notice this is a sub menu of a submenu

Featured Threads

Hot Threads This Week

Hot Threads This Month