mercredi 3 mai 2017

PHP if statement I want to load some html only if a path to a image is present

Hi i want some help with my PHP if statement i have a database which holds the path to the images, and this is optional so some a are left null. i want to to print nothing if the field is null and print this if there is a path or any data echo '<img src="..'.$row2[$i]['qpicture_dir'].'", style="float:">';

this is my if statement

if (!empty($row2[$i]['qpicture_dir']) ){
  echo '<img src="..'.$row2[$i]['qpicture_dir'].'", style="float:">';
  }else{
  echo "";
  }     

Aucun commentaire:

Enregistrer un commentaire