Placing an IF with various conditions

0

I want to put an If with several conditions.

if ($row[??] != '' or NULL or 0000-00-00 )

I currently have this, but I want to add two more Rows. do I have to create more if or can I add in this If?

    
asked by anonymous 04.08.2014 / 13:24

1 answer

6

The problem with your if is that or is comparing nothing to anything.

You need to compare again with something ( $row[??] in your case):

if ($row['xpto'] != '' and $row['xpto'] != NULL and $row['xpto'] != '0000-00-00' )

Improving your code, to check if the variable is empty ( '' or NULL ), use the empty .

if (!empty($row['xpto']) and $row['xpto'] != '0000-00-00' )

PS.: Do not forget the quotes on the date! (% with%)

PS2.: Looking further, as you are checking what is different , then the correct operator to use is '0000-00-00' (or and )

    
04.08.2014 / 13:36