Variable Visions

Articles MySQL PHP-IF-statement-for-hidding-NULL-fields-from-a-MySQL-database


tutorials - MySQL and Web-Development.

PHP IF statement for hidding NULL fields from a MySQL database

Published Tue. Jul. 31, 2012


This if statement will hide the image container when the result is NULL.

<?php
        if ($row_new['introimage'] != NULL) {        
        ?>
       
        <div class="masquehome">
            <a href="<?php echo $row_new['introimage'];?>" class="image lightbox">
            <img class="imageviewhome" id="imageviewhome" src="<?php echo $row_new['introimage'];?>" alt="" />
            </a>
        </div><!-- end masquehome -->
     
          <?php
          }
        ?>

 

 

Well look into TRIM and === next time.


Tag(s): PHP, IF statement, NULL



RECENT ARTICLES:

PUBLISHED ON 06.1.23arrowBuilding a JavaScript Metronome using Open AI Chat GPT

PUBLISHED ON 05.15.23arrowHow Do I Remove Footage Gaps in Adobe Premiere

TAGS

CATEGORIES