0
I’m practicing a little php, and when I run it, this error appears on the screen of the host:
Parse error: syntax error, Unexpected 'Exit' (T_EXIT), expecting ',' or ';' in C: xampp htdocs login.php on line 22
i understand what is 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();
}
}
?>
]
Looks like we missed one
;
in the echo before theexit();
,} else {
 echo "dados incorretos"
you are using some IDE?– rray
Yes, I am using an IDE, Brackets, although not yet suitable for server side, is only for testing even.
– user12096