mysql query problematic [closed]

-3

I have the following data
admlogin: admin1 admsenha: admin
admlogin: admin2 admsenha: admin
admlogin: admin3 admsenha: admin

  <form action="#" method="post" id="frm_login_p" name="frm_login_p">
    <input class="form-control" type="text" name="p_login" placeholder="Login, CNPJ ou Telefones" id="p_login">
    <input class="form-control" type="password" name="p_senha" required="" placeholder="Senha" maxlength="255" minlength="2" id="p_senha">
  </form>


<?php 
$atividade='1';
$login=$_POST['p_login'];
$senha=$_POST['p_senha'];
$sql="SELECT id,nome,cnpj FROM  tbl_postos WHERE cnpj='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR telefone='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR whatsapp='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR email='".$email."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR admlogin='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."'"; 

        if ($result = @mysqli_query($CnHUP,$sql)){
        while($row = @mysqli_fetch_array($result)) {
        $ident=$row['id'];
        $cnpj=$row['cnpj'];
        $nome=$row['nome'];
        echo "Identificador: $ident CNPJ: $cnpj Nome: $nome";
        }}
    ?>

At least in theory, only admin / admin should be displayed in the table; the problem is that when finding a lower value ...
for example: adm or admi or admin ... it keeps selecting and displaying information. how to select just the exact value? admin1 or admin2 or admin3

    
asked by anonymous 09.11.2018 / 21:49

1 answer

1

SOLUTION HAS CHANGED THE CONSULTATION

$sql="SELECT id,nome,cnpj FROM  tbl_postos WHERE cnpj='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR telefone='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR whatsapp='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR email='".$email."' AND admsenha='".$senha."' AND ativo='".$atividade."' OR admlogin='".$login."' AND admsenha='".$senha."' AND ativo='".$atividade."'"; 

FOR

$sql="SELECT id,nome,cnpj FROM  tbl_postos  WHERE cnpj in ('".$login."') AND admsenha in ('".$senha."') AND ativo in ('".$atividade."') OR telefone in ('".$login."') AND admsenha in ('".$senha."') AND ativo in ('".$atividade."') OR whatsappin in ('".$login."') AND admsenha in ('".$senha."') AND ativoin ('".$atividade."') OR email in ('".$email."') AND admsenha in ('".$senha."') AND ativo in ('".$atividade."') OR admlogin in ('".$login."') AND admsenha in ('".$senha."') AND ativo in ('".$atividade."')";
    
11.11.2018 / 04:10