• 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

Substitute integers and dots with regex [duplicate]

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

mysql slow on updates for a well optimized query

curl returning 301 error after migrating to https

Update Total in checkout of Woocommerce with Ajax Request

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

How to add a sidebar to Woocommerce Shop Page?

Dropdown with current value from Mysql

Alert message after submitting form in PHP

how to validate form data in codeigniter 4

Limit WooCommerce products in cart only from one custom taxonomy

php echo xml documents with header

Magento 2 - Controller returning blank page

I want to use codeigniter foreign character library in my custom PHP project how i can use it?

Malformed MIME header error in Symfony 5.3

About Contact Privacy policy Terms and conditions