• 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

Put content of wordpress page inside div

Call to a member function fetch_field() on a non-object MySQLiDB

Adding the custom page with add_menu_page function on Wordpress

How to pass security cloudflare server with php curl

How to render html from a @foreach loop in a textarea

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

How to change the app environment at run time?

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Post Form Data To phpmyadmin Database

PHP array slice from position + attempt to return fixed number of items

PHP rotate matrix counter-clockwise

Statement that checks whether a URL contains a particular path?

nginx err_connection_refused, can anyone help me?

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Laravel Jetsream Profile page not loading on fresh install

About Contact Privacy policy Terms and conditions