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! Link to comment https://forums.phpfreaks.com/topic/38705-help-with-simple-statement/ 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. Link to comment https://forums.phpfreaks.com/topic/38705-help-with-simple-statement/#findComment-185915 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? Link to comment https://forums.phpfreaks.com/topic/38705-help-with-simple-statement/#findComment-185916 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. Link to comment https://forums.phpfreaks.com/topic/38705-help-with-simple-statement/#findComment-185920 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. Link to comment https://forums.phpfreaks.com/topic/38705-help-with-simple-statement/#findComment-185983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.