On Mon, 2003-06-30 at 18:09, Steve Marquez wrote:
> I am trying to get php to use two conditions.
> 
> <?php
> 
> if ($biz = my_business and $id_num = "1"){
> 
> echo "stuff...." 
> 
> }
> 
> if ($biz = "my_business" and $id_num ="2"){
> 
> echo "other stuff...."
> 
> }
> 
> ?>
> 
> My question Is, I am not sure if the "and" is correct, it does not work. Is
> there another way to do this? I have tried a plus (+), a (,) and nothing
> seems to work.
> 
> Could someone please help?
> 
> Thanks!
> 
> Steve Marquez

This is all explained in the manual here:

  http://www.php.net/manual/en/language.operators.php

Essentially, you probably want && instead of and (although and also
checks for an 'and' condition, it has lower precedence than &&). Also,
you need to use == or === to check for equality. = is the assignment
operator, and attempts to assign the value of the expression on the
right to the variable on the left.

Also, you should quote any strings.

So:

if ($biz == 'my_business' && $id_num == '2')
{
    . . .
}
...etc.



Hope this helps,

Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to