• 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

Converting alphabet letter to alphabet position in PHP [duplicate]

Where do I need to place a hook for phpunit?

Get all WooCommerce products within own plugin

Target class controller does not exist - Laravel 8

How to Display Data in Yajra Datatables Laravel 7?

Get data from accuweather api url

add " ? " in url via htaccess RewriteRule

PHP Include for HTML?

Laravel database insert with combining array and string

php retrieve specific data onclick from database in a list format

Laravel s3 upload file with metadata using pre-signed url

echo language construct is discouraged. (PHP)

Check for PDO Results, If None Display Message, If Yes then Loop Through

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

About Contact Privacy policy Terms and conditions