mysqli_query() always return true

前端 未结 4 1162
清歌不尽
清歌不尽 2021-01-03 10:58

This is my form:



  
  
  
    
4条回答
  •  Happy的楠姐
    2021-01-03 11:38

    $r will only be false if there was SQL error. Otherwise it will always return a resource ID even if no rows are returned by your SELECT statement.

    Use mysqli_num_rows() to count how many rows are returned. Zero means no one is using that email address.

    if(mysqli_num_rows($r))
        echo "Email address exists!";
    else
        echo "sss"; 
    

提交回复
热议问题