我正在尝试将旧mysql
代码更改为mysqli
。我是两个新手,不知道我的mysqli_fetch_array
声明有什么问题。
警告:mysqli_fetch_array()期望参数1为mysqli_result
,给定字符串
session_start(); // start session cookies
include("includes/vars.php");
include("includes/functions.php");
//default values for variables.
$logged_status ='';
$username = '';
$msg = '';
$co='';
$result='';
$mycon=mysqli_connect("localhost","REDACTED","REDACTED","reinvest_auctions");
if(isset($_REQUEST['co'])){
$co=$_REQUEST['co'];
}
//Checks if there is a login cookie
if(isset($_COOKIE['username']) && isset($_COOKIE['password'])){
$_SESSION['username'] = $_COOKIE['username'];
$_SESSION['password'] = $_COOKIE['password'];
}
//if sessions set, call Db to check pwd
if(isset($_SESSION['password']) && isset($_SESSION['username'])){
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$sql = "SELECT * FROM `members` WHERE c_email = $username";
$check = mysqli_query($mycon, $sql);
while($info = mysqli_fetch_array($result))
{
if ($password != stripslashes($info['c_password']))
{
clear();
}
else
{
redirect('home.php?co='.$co.'');
}
}
}