Hello,
I have a custom sql program within drupal 6 that needs to get the current highest node id nid. I thought I could get it from node table, which i thought is e.g. 47, as there are only 47 records listed there (also i can get it using max nid). this has been true before, but now, when i tried to create a new content from create content, its number is different: rather than the next number like 48, it uses something like 745, and then 746... When i check the node table by exporting it, it says:
CREATE TABLE IF NOT EXISTS `node` (
`nid` int(10) unsigned NOT NULL auto_increment,
`vid` int(10) unsigned NOT NULL default '0',
`type` varchar(32) NOT NULL default '',
`language` varchar(12) NOT NULL default '',
`title` varchar(255) NOT NULL default '',
`uid` int(11) NOT NULL default '0',
...
`translate` int(11) NOT NULL default '0',
PRIMARY KEY (`nid`),
UNIQUE KEY `vid` (`vid`),
KEY `node_changed` (`changed`),
KEY `node_created` (`created`),
KEY `node_moderate` (`moderate`),
KEY `node_promote_status` (`promote`,`status`),
KEY `node_status_type` (`status`,`type`,`nid`),
KEY `node_title_type` (`title`,`type`(4)),
KEY `node_type` (`type`(4)),
KEY `uid` (`uid`),
KEY `tnid` (`tnid`),
KEY `translate` (`translate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=757 ;
I realize that the nid number comes from 'AUTO_INCREMENT=757' but where could that 757 come from? and is it stored somewhere as the count of nid? I checked all the drupal tables i have, and there is nothing indicating a node with a number around 75x exists... I need to take that unused number out, but don't where it is...
thanks! hujia
Comments
Hi, This can be helpful
http://drupal.org/node/572472