Skip to main content
Inspiring
March 23, 2008
Answered

PHP show if field not empty

  • March 23, 2008
  • 2 replies
  • 604 views
Using PHP. Is there a simple way to modify the "show if recordset not empty" in DW to instead show if a particular field in the recordset is not empty?
This topic has been closed for replies.
Correct answer Newsgroup_User
Justin from Indiana wrote:
> How do I alter to show it the field is simply not empty?

Believe it or not, PHP has a function called empty(). Tie it up with the
negative operator (!), and bingo:

<?php if (!empty($row_queryname['photos'])) {?>
display photo icon here
<?php }?>

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

2 replies

Newsgroup_UserCorrect answer
Inspiring
March 23, 2008
Justin from Indiana wrote:
> How do I alter to show it the field is simply not empty?

Believe it or not, PHP has a function called empty(). Tie it up with the
negative operator (!), and bingo:

<?php if (!empty($row_queryname['photos'])) {?>
display photo icon here
<?php }?>

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
March 23, 2008
Found code such as this for determining if the field is equal to something:

<?php if ($row_queryname['photos'] == '1') {?>
display photo icon here
<?php }?>

How do I alter to show it the field is simply not empty?