richardstan Posted November 7, 2008 Share Posted November 7, 2008 Hi, i have a mysql table with the following columns id, title, description, name, location. when i'm using the insert statement, do i need to put a value in for the ID field if i have set it to INT NOT NULL AUTO_INCREMENT? for example, is the right code? INSERT INTO LISTINGS(ID, TITLE, DESCRIPTION, NAME, LOCATION) VALUES (1, JUG, 2000 YEARS OLD, RICHARD, KENT) or INSERT INTO LISTINGS(TITLE, DESCRIPTION, NAME, LOCATION) VALUES (JUG, 2000 YEARS OLD, RICHARD, KENT) thanks richard. Quote Link to comment https://forums.phpfreaks.com/topic/131847-inserting-values-into-a-table/ Share on other sites More sharing options...
corbin Posted November 7, 2008 Share Posted November 7, 2008 No you do not put a value. Infact, it will probably error if you provide a value. It's called "auto" incrementing for a reason ;p. Quote Link to comment https://forums.phpfreaks.com/topic/131847-inserting-values-into-a-table/#findComment-684917 Share on other sites More sharing options...
fenway Posted November 8, 2008 Share Posted November 8, 2008 In theory, you can put 0 or NULL, but you shouldn't do either. Quote Link to comment https://forums.phpfreaks.com/topic/131847-inserting-values-into-a-table/#findComment-685115 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.