• 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

PHPExcel export HTML table to xlsx

Hide email address with stars (*)

What will the best solution for this multiple optional filter?

How to make dot match newline characters using regular expressions

Laravel Database Strict Mode

How can I make a full text index of the column?

Pass a select with mysqli_fetch_row to a table

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

Undefined variable in Laravel 8 project (php 7.4)

Display the default discounted price and percentage on Woocommerce products

Laravel display validation error

PHP random string generator

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

Laravel Mix Uncaught ReferenceError: $ is not defined

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

About Contact Privacy policy Terms and conditions