Monk3h Posted September 27, 2008 Share Posted September 27, 2008 is this correct? Im trying to use AND but i have no idea how to include it. $check = mysql_fetch_array(mysql_query("SELECT * FROM `alphaground` WHERE `x` = '$x' & `y` = '$y'")); elseif ($check['x'] == $stat['x'] & $check['y'] == $stat['y']) Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/ Share on other sites More sharing options...
wildteen88 Posted September 27, 2008 Share Posted September 27, 2008 MySQL does not understand & use AND instead. Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/#findComment-651917 Share on other sites More sharing options...
Monk3h Posted September 27, 2008 Author Share Posted September 27, 2008 Thank you, also the second one does not work. (PHP) Any ideas? is the Syntax correct? Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/#findComment-651923 Share on other sites More sharing options...
DarkWater Posted September 27, 2008 Share Posted September 27, 2008 You need && for AND in PHP, because & by itself is the bitwise AND operator, which is completely different. Use &&. Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/#findComment-651928 Share on other sites More sharing options...
Acs Posted September 27, 2008 Share Posted September 27, 2008 You could also use AND in php, if I am not mistaken Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/#findComment-652031 Share on other sites More sharing options...
wildteen88 Posted September 28, 2008 Share Posted September 28, 2008 You could also use AND in php, if I am not mistaken Yes it is an alias to && Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/#findComment-652293 Share on other sites More sharing options...
.josh Posted September 28, 2008 Share Posted September 28, 2008 Though you should note that they are not quite the same thing. They have different orders of precedence. Quote Link to comment https://forums.phpfreaks.com/topic/126071-correct-syntax/#findComment-652295 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.