supanoob Posted October 15, 2007 Share Posted October 15, 2007 Ok so i have the followng if query but it doesnt seem to be working. Basically i want to check to see if they person is at one of 2 places by checking the co_ord_y and co_ord_x. <?php if ($town == '1') { if ($co_ord_y != '14' && $co_ord_x != '20' || $co_ord_y != '19' && $co_ord_x != '15') { echo "You are no longer near a river."; DIE(); } } ?> Well everytime i get to one of the coords it throws the "You are no longer near a river." Quote Link to comment Share on other sites More sharing options...
trq Posted October 15, 2007 Share Posted October 15, 2007 What do you expect to happen? And where do you set the $co_ord_y and $co_ord_x variables? ps: There called statements, not queries. And integers should not be surrounded by quotes, this makes them strings. Quote Link to comment Share on other sites More sharing options...
supanoob Posted October 15, 2007 Author Share Posted October 15, 2007 the coords are set in the database when someone moves from 1 place to another, and if they are at the right places i want the grid for them to fish on to be shown. removing the 'from the numbers didnt help any. Quote Link to comment Share on other sites More sharing options...
trq Posted October 15, 2007 Share Posted October 15, 2007 If your recieving the message echo 'You are no longer near a river', it is because your if statement returns true. Simple. I don't know what you want. Quote Link to comment Share on other sites More sharing options...
supanoob Posted October 15, 2007 Author Share Posted October 15, 2007 i only want it to show when they are not on those coords if you know what i mean? so when they are not on 20x 14y or 15x 19y Quote Link to comment Share on other sites More sharing options...
MmmVomit Posted October 15, 2007 Share Posted October 15, 2007 Try this. <?php if ($town == 1) { if (($co_ord_y != 14 && $co_ord_x != 20) || ($co_ord_y != 19 && $co_ord_x != 15)) { echo "You are no longer near a river."; DIE(); } } ?> Quote Link to comment Share on other sites More sharing options...
supanoob Posted October 15, 2007 Author Share Posted October 15, 2007 nah that didnt work >< Quote Link to comment Share on other sites More sharing options...
trq Posted October 15, 2007 Share Posted October 15, 2007 What does this output? <?php die("y = $co_ord_y x = $co_ord_y"); if ($town == 1) { if (($co_ord_y != 14 && $co_ord_x != 20) || ($co_ord_y != 19 && $co_ord_x != 15)) { echo "You are no longer near a river."; die(); } } ?> Quote Link to comment Share on other sites More sharing options...
supanoob Posted October 15, 2007 Author Share Posted October 15, 2007 y = 14 x = 14 ummm, thats abit strange, even in the database it says 14y 20x Quote Link to comment Share on other sites More sharing options...
MmmVomit Posted October 15, 2007 Share Posted October 15, 2007 Actually, this should do it <?php if ($town == 1) { if (($co_ord_y != 14 || $co_ord_x != 20) && ($co_ord_y != 19 || $co_ord_x != 15)) { echo "You are no longer near a river."; DIE(); } } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted October 15, 2007 Share Posted October 15, 2007 Hehe, because it was a typo on my part. die("y = $co_ord_y x = $co_ord_x"); Quote Link to comment Share on other sites More sharing options...
supanoob Posted October 15, 2007 Author Share Posted October 15, 2007 yeah that seems to of worked thanks 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.