• 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 reset Laravel AuthManager/guards in between API calls in tests?

How to use React Router with Laravel?

Problems getting instance of UploadedFile in Yii2

I want to store data in new index as per my key in php [duplicate]

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

PHP contact form configuration [duplicate]

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

Can I use a WooCommerce function without any WooCommerce page?

Need to display only array value in JSON output

how to make my own auto increment in php?

PHP-Sort array based on another array?

In PHP, which is faster: preg_split or explode?

Fetch files from next cloud storage and display in Laravel website

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

About Contact Privacy policy Terms and conditions