to hahawen(变态的大龄青年) ( ) 信誉:123 大侠果然厉害!!在你的指导下,我已经解决了以上问题。不过现在还有一个问题:怎么删除总不成功啊??代码如下: -------------- <? $editID=trim($_POST["editID"]); if($_POST["BtDel"]) { $sql = "DELETE * FROM products WHERE pid=$editID"; $result = mysql_query($sql,$conn) or die("删除失败!" . mysql_error()); //执行删除命令! if ($result){echo "删除成功!";} } ?> ================================================================================= 系统的提示如下: ----------------- 删除失败!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 '* FROM products WHERE pid=' at line 1
WHERE pid = '$editID'试试.
呵呵,没有delete * from table where ....这种写法吧,应该是 delete from table where ...
to screend(流浪小子)大侠按照你的说法做了,但结果是虽然显示了:“删除成功!”[说明程序被执行了],可浏览或查询时发现数据表中该记录还是存在[用其它工具打开数据表也发现记录还在],根本就没被删除掉!这又是怎么回事啊?
我现在想知道的是:我的以上程序究竟有没有错误啊??
大侠果然厉害!!在你的指导下,我已经解决了以上问题。不过现在还有一个问题:怎么删除总不成功啊??代码如下:
--------------
<?
$editID=trim($_POST["editID"]);
if($_POST["BtDel"])
{
$sql = "DELETE * FROM products WHERE pid=$editID";
$result = mysql_query($sql,$conn) or die("删除失败!" . mysql_error()); //执行删除命令! if ($result){echo "删除成功!";}
}
?>
=================================================================================
系统的提示如下:
-----------------
删除失败!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 '* FROM products WHERE pid=' at line 1
delete from table where ...