0
I am doing my login system and is giving the following error when logging in:
Fatal error: Uncaught Error: Call to Undefined Function mysql_query() thrown in D: xampp htdocs login.php on line 41
if (isset($_POST['entrar']) && $_POST['entrar'] == "login")
{
$usuario = $_POST['email'];
$senha = $_POST['senha'];
if (empty($usuario) || empty($senha))
{
echo "Prencha TODOS os campos";
}
else
{
$query = "SELECT nome, email, senha FROM usuarios WHERE email = '$email' AND senha = '$senha'";
$result = mysql_query($query);
$busca = mysql_num_rows($result);
$linha = mysql_fetch_assoc($result);
if ($busca > 0)
{
$_SESSION['nome'] = $linha['nome'];
$_SESSION['email'] = $linha['email'];
header('Location: index.php');
exit;
}
else
{
echo "Login ou senha ligado";
}
}
}
Why should we not use mysql type functions_*?
– NoobSaibot
@Caution when making edits to the code of the question: https://pt.meta.stackoverflow.com/q/6300/132
– Victor Stafusa
@Victorstafusa Thank you for the alert.
– NoobSaibot