I am having a small problem with inserting data into a database, but it makes all the difference in the program I wrote running.
When I run the following queries, "root" needs to have an id of 0, but it always comes out as 2 after I run the queries. Does anyone know why this is happening? Am I missing something?
CREATE TABLE `categories` (
`id` int(21) NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`parent` int(21) default '0',
`lft` int(10) NOT NULL,
`rgt` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
INSERT INTO `categories` VALUES (0, 'root', NULL, 1, 2);
INSERT INTO `categories` VALUES (1, 'New category', 0, 1, 1);