• 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

Having trouble with PDO queries (Notice: Undefined index)

How to load Codeigniter 4 lang file into an array variable

zsh: command not found: php

Querying only one row from a one to many relationship laravel

How to get company posts from LinkedIn via API?

Laravel 8 factory state afterCreating

PHP array, move keys and values to new array, but mix it up

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

Sum column values from multiple arrays

CodeIgniter extend CI_URI undefined method

How to read laravel_session cookies saved in cookie memory of browser in client side?

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

Get sql.h error on MacOS 12 (Monterey) sqsrv and pdo_sqsrv drive installation

Manage independently the decimal number of the price of each product [duplicate]

Submitting a form with ajax in Wordpress

About Contact Privacy policy Terms and conditions