0
我有以下代碼作爲我的購物籃的一部分。插入訂單查詢正在工作,但我無法獲得插入Order_Info查詢來插入數據。任何人都可以幫助給我一些指導嗎?PHP Mysqli插入不工作,但只在一個地方
<?php
include("includes/db.php");
include("includes/functions.php");
if($_REQUEST['command']=='update'){
global $mysqli;
$accountnumber=$_REQUEST['accountnumber'];
$addressbook=$_REQUEST['addressid'];
$date=date('Y-m-d');
$result=$mysqli->query("insert into Orders values('','$date','$findID','$addressbook','Pending')");
$orderid=mysql_insert_id();
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=$_SESSION['cart'][$i]['qty'];
$price=get_price($pid);
$sql("insert into Order_Info values ($orderid,$pid,$q,$price)");
} header("refresh:0;url=my_orders.php");
unset($_SESSION['cart']);
die('');
}
?>
謝謝,這將如何插入? – Trotterwatch
在你的$ sql語句下 – PersyJack