and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've got a table which has an ID field and it automatically increments. When incrementing it incriments in the following order: 1, 2, 3, 4, 5; I would like my IDs to start in this order: 0001, 0002, 0003, 0004, 0005.
How can I achieve this?
This is my table structure:
[syntax="sql"]
CREATE TABLE `orders` (
`id` int(5) NOT NULL auto_increment,
`name` text NOT NULL,
`email` text NOT NULL,
`website` text NOT NULL,
`notes` longtext NOT NULL,
`subpages` int(11) NOT NULL default '0',
`integration` text NOT NULL,
`template` text NOT NULL,
`date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`status` int(11) NOT NULL default '0',
`key` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Subfusion wrote:I've got a table which has an ID field and it automatically increments. When incrementing it incriments in the following order: 1, 2, 3, 4, 5; I would like my IDs to start in this order: 0001, 0002, 0003, 0004, 0005.
CREATE TABLE `orders` (
`id` int(5) NOT NULL auto_increment,
`name` text NOT NULL,
`email` text NOT NULL,
`website` text NOT NULL,
`notes` longtext NOT NULL,
`subpages` int(11) NOT NULL default '0',
`integration` text NOT NULL,
`template` text NOT NULL,
`date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`status` int(11) NOT NULL default '0',
`key` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
I haven't try this way but I thing it can be. so you insert the first vaule is 0001, and too choose autoincrement. Try it