RE: [PHP-DB] Unlimited Categories

2003-01-15 Thread Daevid Vincent
Subject: Re: [PHP-DB] Unlimited Categories Use the parent/child relationship thing: CREATE TABLE Categories ( CategoryID int(11) NOT NULL auto_increment, ParentID int(11) NOT NULL default '0', Category_Name tinytext NOT NULL, PRIMARY KEY (CategoryID) ) TYPE=MyISAM; So at each

Re: [PHP-DB] Unlimited Categories

2003-01-13 Thread Micah Stevens
Use the parent/child relationship thing: CREATE TABLE Categories ( CategoryID int(11) NOT NULL auto_increment, ParentID int(11) NOT NULL default '0', Category_Name tinytext NOT NULL, PRIMARY KEY (CategoryID) ) TYPE=MyISAM; So at each level you can find the subcategories by: SELECT *

RE: [PHP-DB] Unlimited Categories

2003-01-13 Thread Luke Woollard
EG: CREATE TABLE category ( id int not null auto_increment, parent int default 0, name varchar 100, ); The parent field contains the ID of the record of which category it belongs. Then use a recursive function to display the 'levels' of data. (If parent is 0 then it is top level category)