<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<?php
include( "conn.php" );
$username =@ $_POST['username'];
$password =@ $_POST['password'];
CLASS chkinput {
var $name;
var $pwd;
function __construct( $x, $y ) {
$this->name = $x;
$this->pwd = $y;
}
function checkinput() {
include( "conn.php" );
$sql = mysqli_query( $conn, " select * from member where username = ' ".$this->name." ' " );
$info = mysqli_fetch_array( $sql );
if ( $info == false ) {
echo "<script> alert ('不存在此用户!') ; hisrory.back() ;</script>" ;
exit;
} else {
if ( $info[ 'authority' ] == 1 ) {
echo "<script> alert ('该用户已经冻结!') ; hisrory.back() ;</script>" ;
exit;
}
if ( $info[ 'password' ] == $this->pwd ) {
session_start();
$_SESSION[ 'username' ] = $info[ 'username' ];
$_SESSION[ 'ID' ] = $info[ 'ID' ];
header( "location:welcome.php" );
exit;
} else {
echo "<script> alert ('密码输入错误!') ; ;</script>" ;
header("location:loginfail.php");
exit;
}
}
}
}
$obj = new chkinput(trim($username),trim($password));
$obj->checkinput();
?>
</body>
</html>
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in D:\xampp\htdocs\member\chkuser.php on line 22
源码在上面 请问下这个报错怎么解决?