<?php
session_start();
$c=mysqli_connect('mysql.hostinger.in','u808297599_eval','nandini123');
if(!$c)
exit("ERROR");
$db=mysqli_select_db($c,'u808297599_eval');
if(!$db)
exit("ERROR");
$e=$_POST['username'];
$p=$_POST['password'];
$_SESSION['username']=$e;
$query="SELECT * FROM tecaherlogin WHERE username='$username' AND password='$password' ";
$result=mysqli_query($c,$query);
$exists=mysql_num_rows($result);
if ($exists!=0)
{
//while loop
while ($row = mysqli_fetch_assoc($query))
{
$dbusername = $row['username'];
$dbpassword = $row['password'];
}
if($dbpassword==$p)
{
Print '<script>alert("Correct Password!");</script>';
Print '<script>window.location.assign("evaluate.html"); </script>';}
else
{
Print '<script>alert("Incorrect Password!");</script>';
Print '<script>window.location.assign("teacherloginnew.html");</script>';
}
}
else
echo "user does not exist!";
?>
I get this error:
warning:mysqli-fetch-assoc expects parameter 1 to be mysqli_result, string given
This shows up before loading the page, the warning sign should not be there as this is for my project. Please help.