• 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

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

Correctly determine if date string is a valid date in that format

Edit product hook WooCommerce

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

How to convert the int value to inch in PHP [closed]

How to get quarter for future date using Carbon?

Laravel phpunit test failing authorization

How to make a array inside array?

Malformed MIME header error in Symfony 5.3

Laravel-fopen: failed to open stream: Permission denied

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

Unable to match results of php hash_hmac() and coldfusion hmac()

Undefined variable in Laravel 8 project (php 7.4)

Lexik JWT authentication problem "Invalid credentials"

PHPExcel_IOFactory::createWriter causes wrong behaviour

About Contact Privacy policy Terms and conditions