Can anyone help me? I want to make this code work. If the variable $result is empty, I want it to echo "Login Failed." and if it isn't, I want it to echo "Login Successful."
Login Form
<html>
<head>
<title> Student Log In </title>
</head>
<body>
<form action="studentloggedin.php" method="post">
User Number: <input type="integer" name="User_Number" />
Password: <input type="password" name="Password" /></br></br>
<input type="submit" />
</form>
</body>
</html>
Checker for Username and Password in the linked Database
<?php
$con = mysql_connect("localhost","root","usbw");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$usernumber = $_POST['User_Number'];
$password = $_POST['Password'];
mysql_select_db("ict_helpdesk", $con);
$result = mysql_query("SELECT * FROM students WHERE students.user_number = $usernumber and WHERE students.password = $password");
if ($result = "")
echo "Login Failed.";
else
echo "Login Successful.";
?>
Bookmarks