• 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

CodeIgniter extend CI_URI undefined method

Laravel Get Days In Month From Month Number?

Laravel phpunit test failing authorization

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

Best way to scrolldown onpageload

Getting error: CodeIgniterDatabaseBaseResult::getResult in CodeIgniter

Get WooCommerce products from specific category

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

PHP | "The requested PHP extension bcmath is missing from your system."

PHP and WebView - Cookie doesn't are the same

Prestashop webservice API creating cart rules

Laravel: Create morphs() relationship nullable

Laravel 5 session not persisting after user is logged in

Increase value by 1 on button click

About Contact Privacy policy Terms and conditions