2
My problem is the following.I have a table with various product images, but not in all products I have 5images (total BD columns). what intended was to "undo" the html line when the image does not exist. I tried this code
<?php
if (!empty($imagem3)) {
?>
<td class="coluna_foto"><img src="<?php echo $imagem3; ?>" width="75" height="75" ></td>
<?php }else{
return false;
}
?>
It turns out that the html line is always out of php and so it always stays with the link and so when there is no photo always appears the icon to "say" that there is no photo... Someone has a suggestion to solve
What is your default image column value in the BD?
– Tiago P.C
Is the image inside the BD, or are they files and the BD points to them? And what is the false Return? It wouldn’t just be taking the part of Else?
– Bacco
@Bacco, what I have inside the comic is the name of the image. this faulty "$imagem3" has the way and this working.
– Joaquim Ribeiro
@Tiagop. C the default value is "NULL"
– Joaquim Ribeiro
the problem is that it always writes the tag img and therefore always appears that little cross indicating that there is no picture!
– Joaquim Ribeiro
@Joaquimribeiro the answers below should probably solve the problem, but if it is not enough, find a way to the name of the image to be written on the page also as a test, it may be that some value is coming improper.
– Bacco
First, you don’t need to put the logical node when it returns empty (
else { /* faz nada */}
. Then give avar_dump
variable and see what appears when it is "empty". It may beNULL
, for example, then you would have to add&& !is_null ($imagem3) === FALSE
– StillBuggin