I am thinking about how to do recursive content and I'm not sure how to start. I've googled a fair bit and cant find any solutions that seem to work for me.
I am wanting an efficient way of recursively showing this content. Lets say I want a content map for example (see table structure below...)
1
I would like to be able to set the number of levels to show but i dont want to have to have multiple php/mysql queries. I would like some sort of loop.
Can someone point me in the right direction?
Thanks..
CREATE TABLE my_content (
`id` int(10) unsigned NOT NULL auto_increment,
`parent_id` int(10) default '0',
`title` varchar(255) default NULL,
`creation_time` datetime default '0000-00-00 00:00:00',
`content` text,
PRIMARY KEY (`id`)
);
INSERT INTO `my_content` (`id`, `parent_id`, `title`, `creation_time`, `content`) VALUES
('1', '0', 'Content Title 1', '2007-05-10 02:01:31', 'My Content Here 1'),
('2', '1', 'Content Title 2', '2007-05-10 02:01:31', 'My Content Here 2'),
('3', '1', 'Content Title 3', '2007-05-10 02:01:31', 'My Content Here 3'),
('4', '3', 'Content Title 4', '2007-05-10 02:01:31', 'My Content Here 4'),
('5', '3', 'Content Title 5', '2007-05-10 02:01:31', 'My Content Here 5'),
('6', '4', 'Content Title 6', '2007-05-10 02:01:31', 'My Content Here 6');