Jump to content


Photo

if $value & $value


  • Please log in to reply
2 replies to this topic

#1 TEENFRONT

TEENFRONT
  • Members
  • PipPipPip
  • Advanced Member
  • 338 posts

Posted 12 April 2006 - 08:01 PM

hey, i have a review script that displays info from the db.

how do i check if $value and $value exists, and if BOTH OR EITHER exists, display sumthing..

atm im cecking if each exisit one by one so

if ($var) { display bleh } if ($var2) { display bleh2 } and so on, but i want to check if both or either exist, then display bleh.

Does anyone get what i mean lol? sorry if ya dont.
Teenfront.co.uk : Free Teen Chat -  FunkySmileys.co.uk : MSN Smileys -  ArcadeMonkey.co.uk : Free Flash Games
8Baller.co.uk : Free Multiplayer Pool [url=http://8Baller.co.uk]

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 12 April 2006 - 09:37 PM

if (($var) || ($var2)) {
    echo "bleh";
}

Legend has it that reading the manual never killed anyone.
My site

#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 12 April 2006 - 09:42 PM

if ($var1 && $var2) {

         echo "Both exist";

}

elseif ($var1 || $var2) {

         echo "one of them exists";

}

else {

       echo "Neither exist";
}

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users