php/mysql account activation

前端 未结 3 909
一整个雨季
一整个雨季 2021-01-29 10:43

Everything in my new website is working just fine, except that I can\'t get this piece of code to work:

$query = mysql_query(\"SELECT * FROM members WHERE userem         


        
3条回答
  •  温柔的废话
    2021-01-29 11:11

    Change your first line to:

    $query = mysql_query("SELECT * FROM members WHERE useremail = '$useremail'") or die(mysql_error());
    

    And it will spit out the mysql error that is causing the Warning =)

    You should not be presuming the call to mysql_query returns a valid result; It's good practice to always test the result first, e.g.

    $r=mysql_query("SELECT * YADYADA");
    if($r && mysql_num_rows($r)>0){
      $row=mysql_fetch_assoc($r);
    }else{
      //Uh oh, something's not right~~~ throw an exception maybe?
    }
    

提交回复
热议问题