Saturday, 15 March 2014

php - Codeignighter Start with Field (dbforge) -



php - Codeignighter Start with Field (dbforge) -

is there way tell mysql field start counting n or 1000

for below example, want ids start 1000 not 1.

$tables = array( 'products' => array( 'id' => array('type' => 'int', 'constraint' => '11', 'unsigned' => true, 'auto_increment' => true, 'primary' => true, 'startwith'=>1000), ));

in plain mysql yes can set auto_increment no wish define value in defaults

create table `products` ( `id` int (11) not null auto_increment, `title` varchar (255) not null, primary key (`id`) ) auto_increment = 1000 ; insert `products` (`title`) values('test'), ('test1'); see demo

or if table created utilize alter set auto_increment value

alter table `products` auto_increment = 2000; see demo

php mysql codeigniter

No comments:

Post a Comment