This question already has an answer here:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, integer given in F:\Softwares\xampp\htdocs\login-check.php on line 14 connection error
Code:
<?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";
}
}
?>
</div>
mysql_fetch_assoc($check)
should be mysql_fetch_assoc($get)
. You cant get the results of a row number count.
mysql_fetch_assoc($check)
The above should be
mysql_fetch_assoc($get)