I use a mysql_affected_rows on a query but it seems to return false even though the query did execute so i'm a bit confused....
This is what i have:
$check = mysql_query("DELETE FROM $table
WHERE name = '".$darray[0]."' AND
password = '".$darray[1]."' AND uid = '$uid'
AND validation = '22'")
or die(mysql_error());
if(mysql_affected_rows($check)>0){
echo 1;
exit;
} else {
echo 'Less than one!';
exit;
}
Any idea why it says less than one - even though my query did actually delete the row ?
mysql_affected_rows()
获取链接标识符(即连接资源),而不是结果。
mysql_affected_rows
takes in a connection link, not a query. You can leave that parameter empty and it will refer to the last query executed on that connection.
Solved:
Error was that mysql_affected_rows() doesn't expect the query.
More info here: http://php.net/manual/es/function.mysql-affected-rows.php
$check = mysql_query("DELETE FROM $table
WHERE name = '".$darray[0]."' AND
password = '".$darray[1]."' AND uid = '$uid'
AND validation = '22'")
or die(mysql_error());
if(mysql_affected_rows() >0){
echo 1;
exit;
} else {
echo 'Less than one!';
exit;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.