$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}");
The above is the code that I am using. The insert on the last line works correctly and picks up the correct $order_code, $deliv_date and $order_id. There is no error on the update, but the field "deliv_date" is never set to $deliv_date. I just can't see what the problem is logically. Can anyone spot it? I have been going up the wall.
Thanks.