0
Hello. I’m trying to make a comparison in PHP and IF doesn’t work for nothing. I’ve tried several ways and it didn’t work.
The code is:
if(($_GET['categoria']) == 0) {
$mysql = new conexao();
echo 'Erro';
}else{
$mysql = new conexao();
$result = $mysql->sql_query("select * from TB_GALERIA where CATEGORIA=".$_GET['categoria']." ");
while ($row = mysql_fetch_assoc($result)) {
echo '<div class="item">';
echo '<a class="item-hover" href="../../../uploads/midia/15989/maior_maior_DSC_0108.jpg">';
echo '<img src="images/'.$row["IMAGEM"].'" alt="imagem galeria" class="img-responsive lazyOwl" data-src="/images/';
echo $row["IMAGEM"];
echo '">';
echo '</a>';
echo '</div>';
}
}
What is wrong with the if? Thank you!
Is there a mistake?
– novic
What tests were performed? Verified what is the value of
$_GET
What’s coming up? Put that in the question too.– Woss
It does not return an error message, it is just as if $_GET does not return anything. But for example, if I open an existing gallery (with her id), it opens normally. It is as if the searched category was not found, instead of doing the ordered action in IF. $_GET is pulling the values normally, since when accessing the existing categories they normally open.
– Raphael Cordeiro