• 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

Must be of the type array, null given,

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

Composer Script echo

Laravel Command Schedule Not Working Properly

PHP Deprecated issue when running artisan command

Woocommerce redirect after add-to-cart error

Combine array with same value and add other [duplicate]

backup files to google drive using PHP

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

Laravel Database Strict Mode

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

args[max_input] woocommerce if statement confused

phpunit - testing is painfully slow

Laravel Mix Uncaught ReferenceError: $ is not defined

About Contact Privacy policy Terms and conditions