• 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

Cannot connect to own websocket server when on secured domain

If action is on a different page do I use fwrite function

Transform array, set each array element with parent key php

how to upload binary image to sql server using php laravel

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

Fatal error: Array callback has to contain indices 0 and 1

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Querying only one row from a one to many relationship laravel

php script to delete files older than 24 hrs, deletes all files

Laravel Mix Uncaught ReferenceError: $ is not defined

Assets not referencing to public folder (Laravel)

how to retrieve the first and last instance of a row in pdo dataset

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

Implode array with array of glue strings

Calculating Median of an array in PHP

About Contact Privacy policy Terms and conditions