1
This is supposed to be a login system with access levels that I’m trying to do, but it’s giving an error.
What am I missing?
I’ve tried everything and nothing. I’ve looked at the PHP documentation and nothing.
I wanted it to be object-oriented Mysqli, not PDO.
<?php
// inclusao do arquivo de conexao ao banco de dados
include("conexao.php");
// se existir o clicar do botao logar do formulario
if(isset($_POST['logar'])){
// se existir o login do usuario digitado
if(isset($_POST['loginUsuario'])){
// verificação de anti injeção de SQL do campo login do usuario
$loginUsuario = $conexao->escape_string($_POST['loginUsuario']);
//se existir a senha do usuario digitado
if(isset($_POST['senhaUsuario'])){
// verificação de anti injeção de SQL do campo senha do usuario
$senhaUsuario = $conexao->escape_string($_POST['senhaUsuario']);
$consulta = "SELECT * FROM usuarios WHERE loginUsuario = $loginUsuario AND senhaUsuario = $senhaUsuario";
$resultado = $conexao->query($consulta);
$linha = $conexao->num_rows($resultado);
echo $linha;// Aqui queria que dizesse que existe o registro pelo login do usuario
// Eu digitasse login: admin e senha: 123, aparecesse 1, porque tem dentro do registro
// E se digitasse qualquer outra coisa aparecesse 0, porque não tem dentro do registro
}// isset do campo senha do usuario
}// isset do campo login do usuario
}//isset botão logar
?>
Error appears?
– rray
Which error appears?
– Darlei Fernando Zillmer
Error 500, I am making this application inside my hosted server.
– Wesley Rodrigues
https://weec-sistemas.000webhostapp.com/login.php puts something in the login to see the error.
– Wesley Rodrigues
You need to enable the error view. Add these two lines at the beginning of the script.
ini_set('display_errors', true); error_reporting(E_ALL);
– rray
I’ll put it on now, let’s see.
– Wesley Rodrigues
thanks for the tip.
– Wesley Rodrigues
gave this error now Fatal error: Call to Undefined method mysqli::num_rows() in /Storage/ssd3/459/3838459/public_html/login.php on line 24
– Wesley Rodrigues
already changed, but the same error. my script is above what I’m missing?
– Wesley Rodrigues
This is login.php, but everything is inside a page.
– Wesley Rodrigues
Below the last line of the code you have a include to call the header.php page and a form with login and button fields, then another include with footer.php and a mysqli_close();
– Wesley Rodrigues