• 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

Mysqli multi query error

phpmysqli


PHP Snippet 1:

$data = [
    ['col1' => 'foo1', 'col2' => 'bar1'],
    ['col1' => 'foo2', 'col2' => 'bar2'],
];
// prepare SQL query once
$stmt = $mysqli->prepare("INSERT INTO table SET col1 = ?, col2 = ?");

$mysqli->begin_transaction();
// loop over the data array
foreach ($data as $row) {
    $stmt->bind_param("ss", $row['col1'], $row['col2']);
    $stmt->execute();
}
$mysqli->commit();

Related Snippets

How to send image,audio or video through the WhatsApp API - PHP

How to get total pages of PDF with FPDF?

how to sort by a custom appended relation to model

Remove categories with all childs derived from parent category

Laravel multi auth - Authentication user provider [] is not defined

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

Getting output of MS stored procedure on php call

Dynamic table in HTML using MySQL and php

Spam Filter in Contact Form

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

Edit product hook WooCommerce

Form Validation and Submission to database

laravel MVC execution flow

How to add a sidebar to Woocommerce Shop Page?

PHP: PDO + CSV export not downloading (headers issue?)

About Contact Privacy policy Terms and conditions