title: Zend Framework: lastInsertId is returning 0
body: <p>I am currently learning Zend Framework from a book called "Appress Pro Zend Framework Techniques, Build a Full CMS Project" and I am stuck at a point where after submitting a bug, the page was suppose to redirect to <code>confirm</code> action, but this redirection depends on the result thrown by the Model, which saves the bug to the database.</p>
  
  <p>Here is the code of model bug </p>
  
  <pre><code>public function createBug($name, $email, $date, $url, $description, $priority, $status) {
      // create a new rows in the bugs table
      $row = $this-&gt;createRow();
  
      // set the row data
      $row-&gt;author = $name;
      $row-&gt;email = $email;
      $dateObject = new Zend_Date($date);
      $row-&gt;date = $dateObject -&gt; get(Zend_Date::TIMESTAMP);
      $row-&gt;url = $url;
      $row-&gt;description = $description;
      $row-&gt;priority = $priority;
      $row-&gt;status = $status;
  
      //Save the new row
      $row-&gt;save();
  
      // now fetch the id of the row you just created and return it
      $id = $this-&gt;_db-&gt;lastInsertId();
      return $id;
  }
  </code></pre>
  
  <p>The records are saved in the database, however the $id is always returning 0, which is causing the redirection to be escaped.</p>