jimmyp3016 Posted February 16, 2007 Share Posted February 16, 2007 Hey guys, Im pretty new to php and mysql and was wondering how to write an if statement that checks 2 conditions. Here is what im trying to do. ------------------------------------------------ If password = blank AND membership = 2 echo "whatever i want" Else echo "nothing" ------------------------------------------------ Could someone help me out with this real quick? Thanks! Quote Link to comment Share on other sites More sharing options...
trq Posted February 16, 2007 Share Posted February 16, 2007 <?php if ($password = '' && $membership = 2) { echo "whatever I want"; } else { echo "nothing"; } ?> PS, You might want to read the manual on ifs, the is the most basic concept in programming. Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted February 16, 2007 Author Share Posted February 16, 2007 ahh the 2 && signs! Hey im still learning Thank you for the help. Everybody has to start someplace right? Quote Link to comment Share on other sites More sharing options...
trq Posted February 16, 2007 Share Posted February 16, 2007 You also could have written.... if ($password = '' AND $membership = 2) { Everybody has to start someplace right? Yeah... and the manual is such place. Quote Link to comment Share on other sites More sharing options...
JBS103 Posted February 16, 2007 Share Posted February 16, 2007 P.S. If you are checking the values of the password and membership, make sure to use "==" instead of "=" in the if statement. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.