mysql_num_rows() expects parameter 1 to be resource, string given in

后端 未结 5 1813
说谎
说谎 2021-01-23 14:13

I have read through many other threads about this exact problem, but i for some reason can not solve my problem. Really need some help.

if (!$username||!$passwo         


        
5条回答
  •  日久生厌
    2021-01-23 14:34

    You can try like this

    $sql= "SELECT * FROM Test WHERE username = '".$username."'";
    $check = mysql_query($sql);
    

    I think your $check returns null that is no user with this username and null can't be a parameter mysql_num_rows() function.

    if($check)
    {
        echo "Username already taken";
    }
    else
    {
      echo "Username available";
      // do other actions
    }
    

提交回复
热议问题