Field 'id' doesn't have a default value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
macbeth
Forum Newbie
Posts: 9
Joined: Fri Apr 24, 2009 9:27 am

Field 'id' doesn't have a default value

Post by macbeth »

I am getting this error when i try to insert data into my mysql database.

Field 'id' doesn't have a default value

Does anybody know why I would be getting this?
DaiLaughing
Forum Commoner
Posts: 76
Joined: Thu Jul 16, 2009 8:03 am

Re: Field 'id' doesn't have a default value

Post by DaiLaughing »

Have you forgotten to include a value for id in your query? MySQL is missing that value and doesn't have a default one to put in. If it is the primary key you probably need to make it auto-increment.
macbeth
Forum Newbie
Posts: 9
Joined: Fri Apr 24, 2009 9:27 am

Re: Field 'id' doesn't have a default value

Post by macbeth »

That was my first thought, but when I went into the database and checked, it is set to auto-increment.
Post Reply