Page 1 of 1

if row1 and row2 are both empty echo row3

Posted: Sun May 10, 2009 7:17 am
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

Re: if row1 and row2 are both empty echo row3

Posted: Sun May 10, 2009 7:20 am
by Defiline
AND — It is completely correct operator.

Re: if row1 and row2 are both empty echo row3

Posted: Sun May 10, 2009 7:27 am
by PHPeanuts
Thanks Defiline, I'm just starting in PHP, so I'm feeling better now ! :D