• 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

How to convert binary string to normal string in php

Form Validation and Submission to database

Reading input in php from terminal

Check if user online laravel

How to remove index.php and index from the URL using htaccess | PHP

Use same method for inertia response and json response Laravel Jetstream

Add custom text under order details on WooCommerce My account view order pages

Can I use a WooCommerce function without any WooCommerce page?

How to disable widget block editor of WordPress?

WordPress Security Standards want me to escape my html, but how to do it correctly?

retrieve data from database using session

Laravel-fopen: failed to open stream: Permission denied

How to get monthly wise data in laravel

WooCommerce Subscriptions: Remove role on cancelled subscription

Show Custom Data in Woocommerce Order Details Admin Area

About Contact Privacy policy Terms and conditions