Hi,
I have this database:
[code]CREATE TABLE IF NOT EXISTS categories
(
catg_id
mediumint(9) NOT NULL AUTO_INCREMENT,
catg_pid
tinyint(1) NOT NULL DEFAULT ‘0’,
catg_name
varchar(50) NOT NULL,
catg_desc
text NOT NULL,
catg_status
tinyint(1) NOT NULL DEFAULT ‘1’,
PRIMARY KEY (catg_id
)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
–
– Dumping data for table categories
INSERT INTO categories
(catg_id
, catg_pid
, catg_name
, catg_desc
, catg_status
) VALUES
(1, 0, ‘Toys’, ‘’, 1),
(2, 0, ‘Computer’, ‘’, 1),
(3, 1, ‘Stuffed Toys’, ‘’, 1),
(4, 1, ‘Mechnical Toys’, ‘’, 1),
(5, 3, ‘Teddy Bear’, ‘’, 1),
(6, 3, ‘Barbie Doll’, ‘’, 1),
(7, 2, ‘Hardware’, ‘’, 1),
(8, 2, ‘Software’, ‘’, 1),
(9, 4, ‘Airplane & Helicopter’, ‘’, 1),
(10, 4, ‘Robot’, ‘’, 1),
(11, 0, ‘Category 5’, ‘’, 1);[/code]
How do I create a tree based on the following ?
Thanks.