|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
hello
i am trying to add a field into a mysql table that will auto increment by 1 for each new record that is inputed. i tried create table newTable ( id integer(11) not null auto_increment primary key, name varchar(20)) when i describe the table, i get this Field Type Null Key Default Extra ----- ---- ---- --- ------- ----- id int(11) PRI 0 auto_increment name varchar(20) YES NULL but after adding some values with the following command "insert into newTable values(1,"sdf"), i get this id name -- ---- 1 sdf 9 dffdsdf 3 23323dsffsdfdf so the table is not autoincrementing the id column |
|
#2
|
|||
|
|||
|
i figured it out. sorry if this was a bother to anyone.
thanks |
|
#3
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by bydavid:
hello i am trying to add a field into a mysql table that will auto increment by 1 for each new record that is inputed. i tried create table newTable ( id integer(11) not null auto_increment primary key, name varchar(20)) when i describe the table, i get this Field Type Null Key Default Extra ----- ---- ---- --- ------- ----- id int(11) PRI 0 auto_increment name varchar(20) YES NULL but after adding some values with the following command "insert into newTable values(1,"sdf"), i get this id name -- ---- 1 sdf 9 dffdsdf 3 23323dsffsdfdf so the table is not autoincrementing the id column[/quote] Hi, In an autoincrement field, just type "null" as its value. MySQL will check the last inserted value and increment 1. ex. insert into newTable values("null","sdf") Bye, G.Bubani |
|
#4
|
|||
|
|||
|
thanks for the infrmation.
and thanks to devshed for probiding such helpful forums. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > autonumber field in mySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|