警告:mysql_fetch_assoc() 期望参数 1 是资源,F:\Softwares\xampp\htdocs\login-check.php 中给出的整数第 14 行连接错误
代码:
<?php
session_start();
if(isset($_SESSION['username']))
{
header("location:home.php");
}
else
{
$user=$_POST['mailid'];
$pass=$_POST['password'];
$con=mysqli_connect("127.0.0.1","rahulk","","weltit");
$get=mysqli_query($con,"SELECT * FROM mem WHERE mailid='$user' AND password='$pass'");
$check=mysqli_num_rows($get);
if ($result=mysql_fetch_assoc($check))
{
$check_pass=$result['password'];
$check_user=$result['mailid'];
if ($check_pass==$pass && $check_user==$user)
{
echo "matched";
}
else
{
echo "wrong pass";
}
}
else
{
echo "connection error";
}
}
?>