Hi PHP newbie here. I'm Having problem with my simple Log-in
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\forum\checklogin.php on line 15
This is my code:
<?php
$con = mysql_connect("localhost", "Root", "");
if(!$con)
{
die("Failed to connect" . mysql_error());
mysql_close($con);
}
mysql_select_db("forum", $con);
$un = $_POST['un'];
$pw = $_POST['pw'];
$result = mysql_query("Select * FROM tblAccount WHERE username='$un' AND password='$pw'");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}
/* if (mysql_num_rows("$result") > 0)
{
header('location:main.php');
}
else
{
header('location:login.php?error=1');
}
*/
?>