I'm trying to create a comparison in my code to verify that the password you entered is the same as the one you entered.
I used it as follows;
function confirmaPedido ($conexao, $numeroPedido, $senha) {
$querySenha = mysqli_query($conexao, "Select senha from adm where senha = $senha");
if (!is_numeric($numeroPedido) || empty($numeroPedido)) {
echo "Por favor insira um NUMERO no campo numero do pedido";
}
elseif ($senha === $querySenha) {
$queryApaga = mysqli_query($conexao, "delete from pedido where pedido = $numeroPedido");
echo "Pedido finalizado com sucesso.";
}
else {
echo "Senha ou Pedido não são validos, tente novamente!";
}
}
If I use the operator to check that $senhaPedido
is exactly equal to $senha
the code jumps to Else.
I received the response from another user but I could not understand it very well.
mysqli_query returns a mysqli_result. You will have to use mysqli_fetch_ * to get the line and then to get the "password" field.
How does query return result? What is the difference between the 2? and how do I "select" the password field in the table and check if it is identical?