if row1 and row2 are both empty echo row3

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PHPeanuts
Forum Newbie
Posts: 10
Joined: Wed Jan 21, 2009 7:46 pm

if row1 and row2 are both empty echo row3

Post by PHPeanuts »

Hello guys,

I'm trying to print some data (C) only when data (A) and data (B) are'nt there (because the user wouldn't had written in the CMS) :

Code: Select all

                                <?php
                                $dataA = get_meta('dataA'); //get_meta is one of the CMS functions
                                $dataB = get_meta('dataB'); //idem here
                                if ( empty( $dataA) AND empty( $dataB) ) { echo dataC(); }
                                ?>
This code seems to work, but I'd like to ask you if the 'AND' operator is correct there, or if the whole code is working just for other reason I'm missing (I don't trust myself at all !)

Thanks for any input
Last edited by Benjamin on Sun May 10, 2009 12:39 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Defiline
Forum Commoner
Posts: 59
Joined: Tue May 05, 2009 5:34 pm

Re: if row1 and row2 are both empty echo row3

Post by Defiline »

AND — It is completely correct operator.
PHPeanuts
Forum Newbie
Posts: 10
Joined: Wed Jan 21, 2009 7:46 pm

Re: if row1 and row2 are both empty echo row3

Post by PHPeanuts »

Thanks Defiline, I'm just starting in PHP, so I'm feeling better now ! :D
Post Reply