Query error in SQL

Asked

Viewed 32 times

0

I am trying to make a bank consultation for access release. When I make the following query:

<?php

   if(isset($_POST['Login'])){
      $user = $_POST['user'];
      $password = $_POST['pass'];
      $sql = MySql::conectar()->prepare("SELECT * FROM `tb_admin.usuarios` WHERE user = ? AND pass = ?");
      $sql->execute(array($user,$password));
      if($sql->rowCount() == 1){
          $_SESSION['login'] = true;
          header('Location: '.PATH);
      }else{
          echo '<script> alert("Nome de Usuário ou senha incorreto!"); </script>';
      }
  }

?>

The browser shows me the following error:

Column not found: 1054 Unknown column 'pass' in 'Where clause

How can I solve?

  • error says there is no column pass on the table usuarios on the bench tb_admin

  • 1

    Thank you very much, solved here

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.