• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

insert multiple rows in a saveall in cakephp

phpcakephpcakephp-2.0cakephp-2.1


PHP Snippet 1:

array(
    'Date' => array(
        0 => array(
            'date' => '08/05/2013',
        ),
        1 => array(
            'date' => '09/05/2013',
        )
    ),
)

PHP Snippet 2:

foreach($items as $lineItem){

    $this->Invoice->create();

    $this->Invoice->save(array(
        'user_id'=>$property['User']['id'],
        'invoice_id'=>$invId['Invoices']['id'],
        'item_id'=>$lineItem['item_number'],    
        'quantity'=>$lineItem['quantity'],
        'price'=>$lineItem['mc_gross']
    );

}

Related Snippets

How to keep value of selected value after form submission?

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

Laravel MSSQL Server Connection not working

Center point of multiple gps coordinates with php

str_replace or preg_replace random number from string

how to pass row id in href of a tag in codeigniter controller?

SQL AVG() to 2 decimals

Laravel Route issues with Route order in web.php

Laravel query builder binding parameters more than once

Problems getting instance of UploadedFile in Yii2

Get WooCommerce products from specific category

get data-value with variable value

generate an Excel file using PHP

How to run a shell as root from php (apache)

ORA-12546: TNS:permission denied error connection to remote oracle server

About Contact Privacy policy Terms and conditions