Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php mysqli_查询和mysqli_fetch_数组需要参数_Php_Mysqli - Fatal编程技术网

Php mysqli_查询和mysqli_fetch_数组需要参数

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

我发现以下错误:

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 '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'");