Here Is My Index.php
<form action="login.php" method="post">
Username: <input type="text" name="usname"/></br>
Password: <input type="text" name="pwname"/></br>
<input type="submit" />
</form>
And Here is my login.php
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("logindb", $con);
$user = $_POST['user'];
$pw = $_POST['password'];
$sql = "select username,password,email from users where username='" . $user. "' and password='" . $pw . "' limit 1";
$result = mysql_query($sql) or die($sql."<br/><br/>".mysql_error());
if (mysql_num_rows($result))
{
setcookie("user", $user , time()+3600);
echo ("You Have Successfully Logged In</br>");
}
else
{
echo ("You Have Failed To Logged In</br>");
}
?>
<a href="/index.php">CLick here To go back Home</a>
And It Always Say Failed