I m a begginer with PHP having started PHP 20 days before. I m trying with the latest version of PHP i.e. PHP 5.5.12 and MySQL i.e. MySQL 5.6.17. I m not being able to fetch data from the table. My php code is:
session_start();
$con=mysqli_connect("localhost","root","","doortolearn");
if (!$con) {
echo "Could not connect to DBMS";
}
$query="select * from teacher where tremail='$_POST[email]' and trpasssword='$_POST[password]'";
$result=mysqli_query($con,$query);
$flag=FALSE;
while ($row=mysqli_fetch_array($result,MYSQLI_BOTH)) {
$_SESSION['email']=$row['email'];
mysqli_close($con);
$flag=TRUE;
header("location: http://localhost/dtlteacher/home.php");
}
if($flag){
mysqli_close($con);
header("location: http://localhost/dtlteacher/index.php?dr=1;");
}
Error is: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\dtlteacher\dblogin.php on line 10