I've just started learning how to implement databases into websites and thus have been trying to add a login function to my own website. However, when pressing submit to log in, I get the error: Parse error: syntax error, unexpected '$result' (T_VARIABLE) in /opt/lampp/htdocs/login/process.php on line 13.
Below is the code for my processing.php file:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
mysql_connect("localhost", "root", "");
mysql_select_db("login")
$result = mysql_query("select * from users where username = '$username' and password = '$password'")
or die("Failed to query database ".mysql_error());
$row = mysql_fetch_array($result);
if($row['username'] == $username && $row['password'] == $password && ("" !== $username || "" !== $password)) {
echo "Login Success! Welcome, ".$row['username'];
} else {
echo "Failed to Login!";
}
?>
Any help is appreciated.