Php mysqli_查询和mysqli_fetch_数组需要参数
我发现以下错误: 1-mysqli_query()至少需要2个参数,其中1个在 C:\wamp\www\index.php,第13行。 2-警告:mysqli_fetch_array()希望参数1是mysqli_结果,在第14行的>C:\wamp\www\index.php中给出null 我正在使用wamp服务器。当我使用mysql命令时,它告诉我要使用 我和mysqli没有使用mysqli的经验 这是我的两行Php mysqli_查询和mysqli_fetch_数组需要参数,php,mysqli,Php,Mysqli,我发现以下错误: 1-mysqli_query()至少需要2个参数,其中1个在 C:\wamp\www\index.php,第13行。 2-警告:mysqli_fetch_array()希望参数1是mysqli_结果,在第14行的>C:\wamp\www\index.php中给出null 我正在使用wamp服务器。当我使用mysql命令时,它告诉我要使用 我和mysqli没有使用mysqli的经验 这是我的两行 <?php session_start(); include_once 'db
<?php
session_start();
include_once 'dbconnect.php';
if(isset($_SESSION['user'])!="")
{
header("Location: home.php");
}
if(isset($_POST['btn-login']))
{
$email = mysqli_real_escape_string($con, $_POST['email']);
$upass = mysqli_real_escape_string($con, $_POST['pass']);
$res=mysqli_query("SELECT * FROM users WHERE email='$email'");
$row=mysqli_fetch_array($res);
if($row['password']==md5($upass))
{
$_SESSION['user'] = $row['user_id'];
header("Location: home.php");
}
else
{
?>
<script>alert('wrong details');</script>
<?php
}
}
?>
警报(“错误的详细信息”);
请帮助我需要两个参数。第一个是数据库连接,第二个是查询srting
因此,添加$con
作为第一个参数
mysqli_query($con,"SELECT * FROM users WHERE email='$email'");