title: Zend Framework - PDO Insert not working due to empty primary key
body: <p>I have joined another developer in working on a project using Zend Framework and I can't get any database insert statements to work on my local machine. For testing purposes I am using root user and I can get all other statements to work.</p>
  
  <p>My configuration is nginx 1.6.2, PHP Version 5.5.18, and PDO Mysql API Version 5.6.21.</p>
  
  <p>The server configuration is apache 2.0, PHP Version 5.4.22 and PDO Mysql API Version 5.5.34</p>
  
  <p>The problem is every time I try to insert a row into the database I get an error like this</p>
  
  <pre><code>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'id_client' at row 1'
  </code></pre>
  
  <p>In this instance I am trying to insert a row into the <code>$table</code> <code>client</code> using the following code, which is pretty standard in Zend:</p>
  
  <pre><code>$this-&gt;_db-&gt;insert ( $table, $values );
  $id = $this-&gt;_db-&gt;lastInsertId ();
  </code></pre>
  
  <p>This is the array <code>$values</code> I am trying to insert</p>
  
  <pre><code>array (size=13)
    'id_client' =&gt; string '' (length=0)
    'id_profile' =&gt; string '2' (length=1)
    'status' =&gt; string '1' (length=1)
    'client' =&gt; string 'ABC' (length=3)
    'contact' =&gt; string 'Fred' (length=4)
    'phone' =&gt; string '0412345678' (length=10)
    'address' =&gt; string 'Sydney Rd' (length=6)
    'suburb' =&gt; string 'Sydney' (length=6)
    'state' =&gt; string 'New South Wales' (length=15)
    'post_code' =&gt; string '2000' (length=4)
    'notas' =&gt; string '' (length=0)
    'bg' =&gt; string '#FEAF1D' (length=7)
    'logo' =&gt; string '' (length=0)
  </code></pre>
  
  <p>This is the database structure for the table <code>client</code> which shows the primary key <code>id_client</code> at the end</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `client` (
    `id_client` int(20) NOT NULL,
    `client` char(100) COLLATE utf8_spanish_ci DEFAULT NULL,
    `contact` char(20) COLLATE utf8_spanish_ci DEFAULT NULL,
    `phone` char(20) COLLATE utf8_spanish_ci DEFAULT NULL,
    `address` char(50) COLLATE utf8_spanish_ci DEFAULT NULL,
    `suburb` char(30) COLLATE utf8_spanish_ci DEFAULT NULL,
    `state` char(20) COLLATE utf8_spanish_ci DEFAULT NULL,
    `post_code` char(6) COLLATE utf8_spanish_ci DEFAULT NULL,
    `county` char(20) COLLATE utf8_spanish_ci DEFAULT NULL,
    `notas` text COLLATE utf8_spanish_ci,
    `logo` varchar(200) COLLATE utf8_spanish_ci DEFAULT NULL,
    `bg` char(10) COLLATE utf8_spanish_ci DEFAULT NULL,
    `id_profile` int(2) DEFAULT NULL
  ) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
  
  ALTER TABLE `client`
   ADD PRIMARY KEY (`id_client`), ADD KEY `id_profile` (`id_profile`);
  </code></pre>
  
  <p>As you can see in the <code>$values</code> array there is no value for <code>id_client</code> which is why I am getting the error, but in the zend framework (and others) the insert statement should still work as the database will automatically assign a value based upon the <code>AUTO_INCREMENT</code>. That's how it is working on the server, but it's not doing so on my localhost.</p>
  
  <p>Any help would be appreciated.</p>