Einfach per Kommata die einzelnen Werte-Blöcke (in Klammern) trennen.
Mein Test-Code war:
test1.php:
test2.php:
Mein Test-Code war:
test1.php:
PHP:
<?php
$connection = mysqli_connect('***','***','***','***') or die('ERROR');
$text = str_repeat('ABCDE', 51);
$limit = 1000;
$time1 = array(microtime(true));
for ( $i=0; $i<$limit; $i++ )
{
mysqli_query($connection, 'INSERT INTO big_table (sometext) VALUES (\''.$text.'\')') or die(mysqli_error($connection));
}
$time1[] = microtime(true);
echo $time1[1]-$time1[0] . '|' . memory_get_usage();
?>
PHP:
<?php
$connection = mysqli_connect('***','***','***','***') or die('ERROR');
$text = str_repeat('ABCDE', 51);
$limit = 1000;
$time2 = array(microtime(true));
$queries = 'INSERT INTO big_table (sometext) VALUES (\''.$text.'\')';
for ( $i=0; $i<$limit; $i++ )
{
$queries .= ',(\''.$text.'\')';
}
mysqli_query($connection, $queries) or die(mysqli_error($connection));
$time2[] = microtime(true);
echo $time2[1]-$time2[0] . '|' . memory_get_usage();
?>