I'm practicing a bit of php, and when I run it, this error appears on the local host screen:
Parse error: syntax error, unexpected 'exit' (T_EXIT), expecting ',' or in C: \ xampp \ htdocs \ login.php on line 22
I understand what syntax error, however, I would like to understand the error.
[
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "users";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM user WHERE username='".$username."'AND password='".$password."'LIMIT 1";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "logado";
exit();
} else {
echo "dados incorretos"
exit();
}
}
?>
]