我的mysql更新查询无效

时间:2014-03-08 06:34:08

标签: php mysql

由于某种原因,我无法让它发挥作用。

在此先感谢,一只眼睛可能有所帮助!

$sql3 = "SELECT order_id FROM orders WHERE order_code = '$order_code'";
$result3 = $conn->query($sql3) or exit("Error code ({$conn->errno}): {$conn->error}");

$row = mysqli_fetch_assoc($result3);
$order_id = $row['order_id'];       

$deliv_date = date('Y-m-d');

$sql = "UPDATE orders SET deliv_date = $deliv_date
                WHERE order_id = $order_id";
$result = $conn->query($sql) or exit("Error code ({$conn->errno}): {$conn->error}");

$sql1 = "INSERT INTO invoice VALUES (0,'$order_code','$deliv_date','','$order_id')";

$result1 = $conn->query($sql1) or exit("Error code ({$conn->errno}): {$conn->error}");

1 个答案:

答案 0 :(得分:1)

试试这个

$sql = "UPDATE `orders` SET `deliv_date` = '".$deliv_date."'
                WHERE `order_id` = '".$order_id."'"