请帮我弄清楚这一点。第一个查询将返回一条消息,说明
Couldn't execute query: Unknown column 'ssd23' in 'where clause.
ssd23
是价值$_POST
将从 html 表单中获取的 pnumber 的值。但是,如果只有数字,它会起作用。
$result = mysqli_query($con, "DELETE FROM Tools WHERE PartNumber = {'$_POST['pnumber']'}") or die ("Couldn't execute query: " .mysqli_error($con));
使用变量后,下面的第二个查询将同时处理数字和字符。
$test = $_POST['pnumber'];
$result = mysqli_query($con, "DELETE FROM Tools WHERE PartNumber = '$test'") or die ("Couldn't execute query: " .mysqli_error($con));