• 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

Laravel 5.1 Unknown database type enum requested

How can I make Laravel return a custom error for a JSON REST API

PHP using str_starts_with for array to exclude same as with wildcard

onKeyUp event calculation not working on the following rows from php generated forms except the first one

Hide specific products from unlogged users based in product category in WooCommerce

PHPExcel file download using AJAX call

How to add automatically collapse/expand in content wordpress (single.php)?

Woocommerce redirect after add-to-cart error

Laravel Delete and Update

Laravel websockets AWS EC2 - Connection failed

How to skip cart page on woocomerce for certain products only?

PHP -> Next nearest date defined by array of days in week

Yii2: How do I debug console commands?

Increase value by 1 on button click

PHP: convert all UTF-8 characters to HTML entities

About Contact Privacy policy Terms and conditions