faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 14 people (64%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Can PHP automatically update auto incremented numbers in MYSQL?

Nov 17th, 2002 00:05
Mariusz Stankiewicz, Shane Burdan,


My MySQL is a little rusty but if you had a table as such:
create table testtable(
  myidfield int auto_increment,
  mydata    varchar
);
you insert data into the table as such:
INSERT INTO testtable (mydata)
VALUES ('foobar');
notice that the myidfield is not used in the above insert statement.  
This tells mysql and most other databases with a autonumber/default 
value to increment that field automatically, or leave that value as the 
default.
cheers,
Mariusz
http://foa.homeunix.net
mariusz(at)foa.homeunix.net