我不断收到以下错误: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)。 –