I have a problem that I can not solve (I do not understand much of php) that I think is simple.
I am pulling a list of products from a database, however some products have no image and I would like it at the time of the Loop it does not load those that have some empty line.
For example: If you do not have anything on the line "imgmarca" it does not take this product on the screen.
Or rather, if you have nothing, it does not display the product.
Follow the code.
<?php
$query = sprintf("SELECT * FROM techloja ORDER BY RAND(), id DESC LIMIT 12");
$dados = mysql_query($query, $con) or die(mysql_error());
$linha = mysql_fetch_assoc($dados);
$total = mysql_num_rows($dados);
if($total > 0) {
do {
?>
<div class="produto_interna" title="<?=$linha['nome']?>" >
<a href="<?=$linha['link']?>">
<div class="nome"><p><?=$linha['nomepeq']?> </p></div>
<div class="foto">
<div class="foto_img"><p><img src="<?=$linha['img']?>" title="<?=$linha['nome']?>" alt="<?=$linha['nome']?>" /></p></div>
<div class="loja"><p><img src="<?=$linha['imgmarca']?>" height="30px" /> <span style="float:right; font-size:1.5em; font-weight:bold; color:#BC0003; margin-top:5px;">R$ <?=$linha['valor']?></span></p></div>
<div class="comprar"><img src="images/comprar_bt.jpg"/></div>
</div>
</a>
</div>
<?php
}while($linha = mysql_fetch_assoc($dados));
}
?>