Home >Backend Development >PHP Tutorial >Fatal error: Call to a member function fetch_array() on a non-object in 62 line,该如何处理

Fatal error: Call to a member function fetch_array() on a non-object in 62 line,该如何处理

WBOY
WBOYOriginal
2016-06-13 12:16:491249browse

Fatal error: Call to a member function fetch_array() on a non-object in 62 line
 if($_POST[admin_user]!="" || $_POST[admin_pass]!="")
  {
   $conn=new mysqli("localhost","root","db_wlgl);
    $conn->query("set names gb2312");   
    $admin_user=$_POST[admin_user];
    $admin_pass=($_POST[admin_pass]);
    $sql=$conn->query("call admin_regs('".$admin_user."','".$admin_pass."')");
    $res=$sql->fetch_array(MYSQL_BOTH);  //62行
  if($res!=NULL){

session_register("admin_user");
session_register("admin_pass");
   echo "<script>alert('管理员登录成功!');window.location.href='indexs.php';</script>";
}else{
    echo "<script>alert('管理员登录失败!');</script>";   
 }
}

?>
------解决思路----------------------
在62行上面 echo $conn->error; 看看

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn