I have the following code:
$query = "SELECT * FROM pedidos WHERE usuario = '$usua' AND status_pedido = 'ESPERANDO' ";
$result = mysqli_query($db, $query);
if ($result){
echo '<div class="alert alert-danger" role="alert"" >
<h3>
LO SENTIMOS, USTED POSEE UN PEDIDO EN ESPERA
</h3>
</div>';
} else { echo '<div class="alert alert-danger" role="alert"" >
<h3>
AQUI SE IMPRIME UN FORMULARIO
</h3>
</div>';}
The idea is that if condition 1 and condition 2 of results are met
The usuario = '$usua'
condition will almost always show results but not necessarily the condition status_pedido = 'ESPERANDO'
as it always gives results even when the second condition is "ENTREGADO"
I would like to know if there is a way to change the way to query MySQL.