Jump to content

[SOLVED] inserting values with auto increment


proggR

Recommended Posts

I have a db setup and a table with the columns postID, file, title, course, date and directory. postID is the primary key and is set to auto increment. When I go to insert the values do I skip the postID and start on the file or do I have to insert the postID everytime? or just the first time?

I'm assuming INSERT INTO table VALUES ('$file', '$title', '$course', '$date', '$directory') would throw an error since it would see the first value in $file and try to insert it in the postID columb which is an INT (wheras file is VARCHAR).

Could anyone clarify this?

Ok thanks. I also realized i could go INSERT INTO table (file, title etc....) but that's just a hassle so thank you :).

And also, with the auto increment, does it default my first value to one so i NEVER have to enter anything for it. Or do i have to initialize it at one the first time its used?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.