Sep 24, 2003 #1 webIntern Programmer Joined Nov 22, 2002 Messages 40 Location US inserting a new record with an auto-increment field??
Sep 24, 2003 #2 sleipnir214 Programmer Joined May 6, 2002 Messages 15,350 Location US Assume: Code: create table foo ( ID int unsigned auto_increment primary key, name varchar(10) ) Either of: Code: INSERT INTO foo (name) values ('foo') INSERT INTO foo (ID, name) values (NULL, 'foo') Would insert the value and cause MySQL to set the ID column to the auto_increment. Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!! Upvote 0 Downvote
Assume: Code: create table foo ( ID int unsigned auto_increment primary key, name varchar(10) ) Either of: Code: INSERT INTO foo (name) values ('foo') INSERT INTO foo (ID, name) values (NULL, 'foo') Would insert the value and cause MySQL to set the ID column to the auto_increment. Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!!