Hello, im trying to create php code for my login page. It continuously shows incorrect password even if the password on the database is correct.
- PLEASE HELP
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '*********************';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
else {
if(isset($_POST['username']))
{
$username= $_POST['username'];
$password= $_POST['password'];
$sql="select * from loginform where username='$username'AND password='$password'";
$result=mysql_query($sql);
if(mysql_num_rows($result)==1)
{
echo " You Have Successfully Logged in";
exit();
}
else
{
echo " incorrect password";
exit();
}
}
}
?>