我已经有了这段代码:
<?php
if ($quantity == 0){
$prd_name = " ";
$colors = " ";
$sizes = " ";
$quantity = " ";
$price = " ";
$TIP = " ";
$TPA = " ";
$cost = " ";
$amount = " ";
$query ="DELETE FROM orders WHERE quantity='0'";
}
?>
但它仍然会创建一个表行。
我想要做的是当输入的数量为0时,表行将被删除。请耐心等待我,我是php和mySQL编码的新手。
答案 0 :(得分:1)
您忘记执行查询。它应该是
$query = mysql_query("DELETE FROM orders WHERE quantity='0'");
答案 1 :(得分:0)
<?php
if($quantity==0)
{
$query="Delete from orders where quantity=0";
mysql_query($query);
}
?>
答案 2 :(得分:0)
通过将引号移至 0 运行查询如果是数字
<?php
if($quantity==0)
{
$query = "DELETE FROM orders WHERE quantity = 0 ";
mysql_query($query);
}
?>