ID cannot be null (Auto Increment)

Posted by THeK on Stack Overflow See other posts from Stack Overflow or by THeK
Published on 2012-06-10T10:36:26Z Indexed on 2012/06/10 10:40 UTC
Read the original article Hit count: 145

Filed under:
|
|
|

I'm using an INSERT ON DUPLICATE KEY statement for my website. It's for creating news items, so I figured I could use the same MySQL command for both creating and updating news items.

However, when I use the following:

INSERT INTO table (id,title,content) VALUES(NULL,"Test","Test");

Instead of creating a new auto increment value it throws an error. However, the command works on my main development server. But not on my laptop. Both versions of MySQL are the same, the only difference being MySQL was installed manually on my server, and with WAMP on my laptop.

Are there any MySQL Variables that could be causing this?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql