Warning:mysql_num_rows() expects parameter 1 to be resource,boolean given in F:.....\db_func.php onl

当PHP页面报类似如下错误时:

Warning:mysql_num_rows() expects parameter 1 to be resource,boolean given in F:.....\db_func.php online3

Warning:mysql_num_rows() expects parameter 1 to be resource,boolean given in F:.....\db_func.php onl_第1张图片

Warning:mysql_num_rows() expects parameter 1 to be resource,boolean given in F:.....\db_func.php onl_第2张图片

应该先判断是否有,用如下代码

if($res){
return mysql_num_rows($res);
}else{
return false;}

即如下代码所示即可:





你可能感兴趣的:(03,PHP,boolean,given,in,F..)