views:

970

answers:

1

How to set the initial value (for example for "id" column) that start from 1001??

I do a insert "INSERT INTO users (name, email) VALUES ('{$name}', '{$email}')";

Without specify the initial value.

+3  A: 

Use this:

ALTER TABLE users AUTO_INCREMENT = 1001;

or if you haven't already id column, also add it

ALTER TABLE users ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    ADD INDEX (id);
Anatoliy
I do as what u said.. "ALTER TABLE users AUTO_INCREMENT = 1001;", but it seems like does not work. I did it in phpmyadmin, i am using mysql 5
bbtang
It works now.. Thanks :)
bbtang