Erro: mysqli_query() expects at least 2 parameters, 1 given in
Boa tarde, pretendo fazer uma pagina de login, porém todavia aparece o erro abaixo: Se possível alguém poderia me ajudar?
link do tutorial que estou seguindo: https://www.youtube.com/watch?v=-yUMdFWrPJc
/applications/core/interface/imageproxy/imageproxy.php?img=https://s31.postimg.org/dnqomq4bv/php.jpg&key=40a7d3ab93ac8d22e69476797921dcad0ec2d5823e9adb431b5b2152532ae040" alt="php.jpg" />
Arquivo 1 - userauthentication.php
<?php
$host = "localhost";
$user = "root";
$pass = "";
$banco = "cadastro";
$conexao = mysqli_connect($host, $user, $pass) or DIE (mysql_error());
mysqli_select_db($banco) or DIE (mysql_error());
?>
<html>
<head>
<title>Autenticando usuário</title>
<script type="text/javascript">
function loginsuccessfully() {
setTimeout ("windows.location='painel.php'", 5000);
}
function loginfailed(){
setTimeout ("windows.location='login.php'", 5000);
}
</script>
</head>
<body>
<?php
$email=$_POST ['email'];
$senha=$_POST ['senha'];
$sql = mysqli_query ("SELECT * FROM usuarios WHERE email = '$email' AND senha = '$senha'") or die (mysql_error());
$row = mysqli_num_rows ($sql);
if($row > 0) {
$_SESSION ['email']=$_POST ['email'];
$_SESSION ['senha']=$_POST ['senha'];
echo "<center>Você foi autenticado com sucesso, Aguade um instante.</center>";
echo "Você foi autenticado com sucesso! Aguade um instante.";
} else {
echo "Nome de usuário ou senha inválido! aguarde um instante.";
echo "<script>loginfailed()</script>";
}
?>
</body>
</html>
Arquivo 2 login.php
<html>
<head>
<title>sistema de login</title>
</head>
<body>
<form name="loginform" method="post" action="userauthentication.php">
email: <input type="text" name="email"/> <br/> <br/>
senha: <input type="password" name="senha"/> <br/> <br/>
<input type= "submit" value="Entra" />
</body>
</html>
Informações:
Wampserer
Obrigado!
Discussão (2)
Carregando comentários...