Jump to content

Help creating if with 2 or more conditions


czs

Recommended Posts

Hi all

 

I'm trying to make an if condition based off more than one criteria.  Here is the code I have now but it doesn't work.  My guess is the word AND isn't the right way to do this.

 


if ($row_rsM1p['Match1'] !== '0' AND $row_rsM1p['Match2'] !== '0' AND $row_rsM1p['Match3'] == '0') {
//do stuff

}

 

Thanks

 

Thank you for helping but that didn't work.  I think there might be a fundamental problem with my if statement.

 

I want it to do the stuff within the statement if the  field "Match1" in the recordset  "rsM1p"  contains just the number 0  .  Is  writing  == '0'    the way I did, the right way to do this?

Update:

 

I replaced '0'  with a hidden field name that I create  'Post0' with a value of 0  and it still didn't work. 

 

Now I'm starting to think that the way I'm referencing the field in the recordset is wrong.

 

Is

 

<?php
if ($row_rsM1p['Match1'] != 'Post0')
?> 

 

the right way to say if field match1 in recordset rsM1p  does not equal the value in the hidden field 'Post0'    ?

PS: AND vs &&: The reason for the two different variations of "and" and "or" operators is that they operate at different precedences. (See Operator Precedence.) http://www.php.net/manual/sl/language.operators.logical.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.