我正试着做一个mysqli_multi_query
。不知为什么它不起作用。
以下是我到目前为止所做的:
<?php
$con=mysqli_connect("host","user","pw","db");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$orderid = $_GET['orderid'];
$sql = "INSERT INTO orders_archive SELECT * FROM orders WHERE orders_id='".$orderid."'";
$sql .= "DELETE FROM orders WHERE orders_id='".$orderid."'";
mysqli_multi_query($con,$sql);
mysqli_close($con);
?>
orderid
由ajax提供。 最佳答案
查询必须用;
分隔。
$sql = "INSERT INTO orders_archive SELECT * FROM orders WHERE orders_id='".$orderid."';";
$sql .= "DELETE FROM orders WHERE orders_id='".$orderid."'";
关于php - mysqli_multi_query不起作用,什么也没发生,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33209712/