Gaia Posted February 12, 2008 Share Posted February 12, 2008 Hi, Not sure if this is really MySQL related or PHP related, sorry if I am posting in the wrong spot! I have a PHP application that uses PDO FrameWork. I have moved it to another web server and now I am having a bit of trouble. Here is the MySQL query: $query = $db->prepare("INSERT INTO entries VALUES ('','$admin', '$admin_ip', '$nickname', '$nick_ip', '$date', '$reason', '$action','','','','','','','$is_dup')"); $query->execute(); The first value is 'id' and is, of course, set to auto_increment. However, PDO is not allowing the value to be empty for some reason. It is throwing out the following error: Array ( [0] => HY000 [1] => 1366 [2] => Incorrect integer value: '' for column 'id' at row 1 ) As far as I know the auto increment field is supposed to be empty/null ? Anyone have any insight on this? Would this perhaps be something caused by MySQL 5.0? I believe the last server was running MySQL 4.1.x but I think the new server is running MySQL 5.x Much thanks in advanced. Quote Link to comment https://forums.phpfreaks.com/topic/90601-pdo-help-incorrect-integer-value/ Share on other sites More sharing options...
toplay Posted February 12, 2008 Share Posted February 12, 2008 I'm not familiar with PDO framework, so make sure they it supports MySQL 5+ by using mysqli_xxx type of functions and not mysql_xxx. Instead of empty string, specify null or 0 (zero) for the id auto_increment column value. Quote Link to comment https://forums.phpfreaks.com/topic/90601-pdo-help-incorrect-integer-value/#findComment-464559 Share on other sites More sharing options...
Gaia Posted February 12, 2008 Author Share Posted February 12, 2008 Thanks, switching the value to 0 worked. I will have to look up on that a bit . Quote Link to comment https://forums.phpfreaks.com/topic/90601-pdo-help-incorrect-integer-value/#findComment-464618 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.