mardi 28 avril 2015

Conditional if statement not working php versions

Using Boostrap and PHP I want my code to display both fields using (class="col-sm-6") if field C is present. If not then only display field B only using (class="col-sm-12"). It aint working. Please help ?

PHP 5.4...I get no error but if statement does not work the way i want when using PHP 5.3...I Get a (Notice: Undefined property: stdClass::$gem_gemstone_para_c in) error

Here is my code.

<?php if (is_null($row->gem_gemstone_para_c)){ ?>
 <div class="post row">
  <div class="col-sm-6">
   <img src="<?php echo $GemstonesImagesDir;?>/<?php echo $row->gem_gemstone_picture_b; ?>" class="img-responsive" alt="" />
  </div>
  <div class="col-sm-6">
   <img src="<?php echo $GemstonesImagesDir;?>/<?php echo $row->gem_gemstone_picture_c; ?>" class="img-responsive" alt="" />
  </div>
</div>
<?php } else { ?>
<div class="post row">
    <div class="col-sm-12">
        <img src="<?php echo $GemstonesImagesDir;?>/<?php echo $row->gem_gemstone_picture_b; ?>" class="img-responsive" alt="" />
        </div>
    </div>

Aucun commentaire:

Enregistrer un commentaire