mercredi 20 décembre 2017

If mysql input is empty echo default image else get picture in a table

I have a little problem getting an image...

That is what I have:

<td data-label="Fotografija">
<?php
    if($row["fotografija"] == "") {
        echo '<img class="myImg" src="images/nislike.png" alt="Fotografija ni na voljo." style="max-width: 20%; min-width:100px;">';
    } else {
        echo '<img class="myImg" src="templates/slike/fotografije/?><?php 
        echo $row["fotografija"]; ?>" alt="<?php echo $row["ime"];?> <?php 
        echo $row["priimek"]; ?>" style="max-width: 20%; min-width:100px;">';
    }?>
</td>

The result is not working like it should.

I am getting the default picture (images/nislike.png) like expected but if there is an entry in mysql, it's not working.

Aucun commentaire:

Enregistrer un commentaire