If I execute example.php, everything looks fine, but the second query (with a2,b2,c2) is not inserted into my table. I tried more queries, but it is always the second which is "ignored". Is it bug, feature or my mistake..? PHP v5.3.3, MySQL v5.1.73
example.php:
$conn = new mysqli($servername, $username, $password, $dbname);
...
$query = "INSERT into mytable (a,b,c) values ('a1','b1','c1');";
$query .= "INSERT into mytable (a,b,c) values ('a2','b2','c2');";
$query .= "INSERT into mytable (a,b,c) values ('a3','b3','c3');";
$query .= "INSERT into mytable (a,b,c) values ('a4','b4','c4')";
...
if ($conn->multi_query($query) === TRUE)
...
have you tried this?
$query = "INSERT into mytable (a,b,c) values ('a1','b1','c1')";
$query .= ",('a2','b2','c2')";
$query .= ",('a3','b3','c3')";
$query .= ",('a4','b4','c4')";
...
...
$query .=";";
if ($conn->multi_query($query) === TRUE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.