I'm having problems with my mysql query . The value is passed from the php form correctly with $_POST
, however when I add the variable to make the comparison the query does not send a response, but if I add the exact value that is in the database I get a response, but I need to use the value which comes from the variable.
This work works
//pegar matricula
$query_matricula = mysqli_query($conexao,"SELECT matricula FROM usuario where nome = 'Maria'") or die("ERROR" .mysqli_error());
$row = mysqli_fetch_assoc($query_matricula);
$numero_matricula = $row['matricula'];
echo $row['matricula'];
That way it does not work
//pegar matricula
$query_matricula = mysqli_query($conexao,"SELECT matricula FROM usuario where nome = '$nome'") or die("ERROR" .mysqli_error());
$row = mysqli_fetch_assoc($query_matricula);
$numero_matricula = $row['matricula'];
echo $row['matricula'];