我不斷收到以下錯誤:PHP MySQL錯誤刪除的行
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order WHERE id = '49'' at line 1
我不明白是什麼原因造成這一點。我檢查過任何語法錯誤,回顧了mysqli文檔,並在堆棧溢出中查找類似的帖子,但沒有運氣。我做錯了什麼?
這是我使用的代碼:
<?php
if (isset($_GET['order_id']) && $_GET['order_id'] != "")
{
$delete_id = $_GET['order_id'];
echo "<p>$order_id</p>";
$conn = new mysqli($server, $user, $password, $database);
$sql = "DELETE FROM order WHERE id = '" . $delete_id . "';";
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
mysqli_close($conn);
}
?>
@Marvin沒有'''運行會出現相同的錯誤。 「id」的數據類型當前設置爲int(11)。 –