469,926 Members | 2,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

how can i store 0 in AUTO_INCREMENT columns as 0

Hi everybody,
i am doing web application implemented with php and mysql. i want to
create a table in the database with auto increment eg
CREATE TABLE $TableName_2(
ID int unsigned auto_increment not null,
name text,
PRIMARY KEY(PartID) )");

i know auto_increment must be begun at 1. However, do u guys have any
idea i can start at 0. Because i want to hard code in id = 0 in my
database. Then other peoeple cannot change eg. insert into ....
values.....(0,Admin). In my web application, i didnt set any password
or priviliage. So can i still set id = 0?
Thanks,
Krista
Jul 19 '05 #1
2 2707
Krista wrote:
i know auto_increment must be begun at 1. However, do u guys have any
idea i can start at 0. Because i want to hard code in id = 0 in my
database. Then other peoeple cannot change eg. insert into ....
values.....(0,Admin). In my web application, i didnt set any password
or priviliage. So can i still set id = 0?


I got a better solution. Add another field to your table that tells the
user status (or just wether user is admin or not).

Portability, readability, build in support for different user levels...

Jul 19 '05 #2
Krista wrote:
i know auto_increment must be begun at 1. However, do u guys have any
idea i can start at 0. Because i want to hard code in id = 0 in my
database. Then other peoeple cannot change eg. insert into ....
values.....(0,Admin). In my web application, i didnt set any password
or priviliage. So can i still set id = 0?


I got a better solution. Add another field to your table that tells the
user status (or just wether user is admin or not).

Portability, readability, build in support for different user levels...

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Paul Lamonby | last post: by
4 posts views Thread by Pjotr Wedersteers | last post: by
4 posts views Thread by jjliu | last post: by
9 posts views Thread by Bart Van der Donck | last post: by
reply views Thread by Shailesh | last post: by
2 posts views Thread by hjyn | last post: by
1 post views Thread by Phil Latio | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.