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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.