我使用此代码来计算行并尝试执行IF num rows equals to ZERO do INSERT if not UPDATE
,但它不起作用。如果mysql_num_rows等于零不起作用
当我使用==
操作符时,什么都不会发生。如果我使用>=
运算符脚本插入值,但在每个刷新上运行插入查询,并且值在MySQL表中复制。
下面是代码:
$isexist = mysql_query("select count(*) from wcddl_filehosts where downloadid = '".$download[id]."'");
if (mysql_num_rows($isexist) == 0) {
mysql_query("insert into wcddl_filehosts (downloadid, rs) values ('".$download[id]."','$totalRS')");
} else {
mysql_query("update wcddl_filehosts set rs = '$totalRS' where downloadid = '".$download[id]."'");
}
这有什么错呢?
重新标记,因为这已经无关的preg_match。 – cypher 2010-07-24 15:26:07