"Dr. Zoidberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> What will be the best database structure for creating web site
> navigation, menus with submenus (unlimited levels).

I'd suggest 2 id columns:

CREATE TABLE menu (
  menuItemID int(11) NOT NULL auto_increment,
  parentMenuItemID int(11) NOT NULL default '0',
  label varchar(255) NOT NULL default '',
  PRIMARY KEY (menuItemID),
  INDEX parentMenuItemID (parentMenuItemID)
) TYPE=myISAM;

At the top level parentMenuItemID is 0, otherwise it's the value of its
parent menuItem. Then you recursively load the menu structure. I think there
are some good PEAR classes to do this.

Regards,

Torsten Roehr

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

Reply via email to