title: cake php insert query in loop
body: <p>Hello Every one i have a function in controller which is checkout where i am submitting a form. 
  But i want to run insert query in a loop on bellow $this->Session->read('Cart') value is 3 but my code insert one record in table if i alert something inside loop it alerts 3 time how can i run insert query 3 time please any one help me.
  Thanks in advance. </p>
  
  <hr>
  
  <pre><code>public function checkout() {
          $this-&gt;loadModel("Checkout");
          Configure::read();
          $aorderno = $this-&gt;Checkout-&gt;find('all', array('order' =&gt; array('Checkout.id' =&gt; 'DESC'),'limit' =&gt; 1));    
          $this-&gt;set('aorderno',$aorderno);
             foreach($aorderno as $order)
             {
             $myorderno=$order['Checkout']['orderno']+1;
             }
          $firstname = $this-&gt;request-&gt;data['checkout']['firstname'];
          $this-&gt;set('firstname',$firstname);
          $lastname = $this-&gt;request-&gt;data['checkout']['lastname'];
          $this-&gt;set('lastname',$lastname);
  if(count($this-&gt;Session-&gt;read('Cart'))&gt;0)
               {
                      foreach($this-&gt;Session-&gt;read('Cart') as $value)
                      {
                      $sku=$value['Product']['sku'];
                      $this-&gt;Checkout-&gt;save(array('orderno' =&gt; $myorderno,'firstname' =&gt; $firstname,'lastname' =&gt; $lastname'sku' =&gt; $sku));
                      }
               }
  }
  </code></pre>