0

我已经有这个代码:

<?php
if ($quantity == 0){
$prd_name = " ";
$colors = " ";
$sizes = " ";
$quantity = " ";
$price = " ";
$TIP = " ";
$TPA = " ";
$cost = " ";
$amount = " ";
$query ="DELETE FROM orders WHERE quantity='0'";
}
?>

但它仍然会创建一个表格行条目。

我要做的是当输入的数量为 0 时,表格行将被删除。请多多包涵,因为我是 php 和 mySQL 编码的新手。

4

3 回答 3

1

您忘记执行查询。它应该是

$query = mysql_query("DELETE FROM orders WHERE quantity='0'");
于 2012-07-31T05:39:15.137 回答
0
<?php
    if($quantity==0)
     {
       $query="Delete from orders where quantity=0";
       mysql_query($query);
      }
 ?>
于 2012-07-31T05:50:06.547 回答
0

一旦通过将Quotes删除为0来运行查询,如果它是一个数字

<?php
    if($quantity==0)
     {
       $query = "DELETE FROM orders WHERE quantity = 0 ";
       mysql_query($query);
      }
 ?>
于 2012-07-31T05:55:40.723 回答