R1der Posted January 25, 2007 Share Posted January 25, 2007 ok i am having a problem with this bit of codeing (No errors)[code]<? if($user['wilderness'] == 1 && $ir['posX'] == $users['posX'] && $ir['posY'] == $user['posY']){ print "{$user['username']}";}?>[/code]ok i have tried everything i can think of to get this to work,Basicly i want it to show the username of all users who is in the same place as them on like a coordinate map kinda thing. But i cant get it to show the users even tho there are users in the same location as them.This is how it showsYou are currently at (0,0)NorthWest EastSouthYou are see:*****(here is where it should show the users)*****Hope this makes sence Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted January 25, 2007 Share Posted January 25, 2007 If you echo each of the variables before hand, do they show the correct data?That should be the first thing you do, if they aren't then it's likely to be variable assignment at fault, if they are then it's the if statement.RegardsHuggie Quote Link to comment Share on other sites More sharing options...
R1der Posted January 25, 2007 Author Share Posted January 25, 2007 yes the variables seem to work fine Quote Link to comment Share on other sites More sharing options...
Tyche Posted January 25, 2007 Share Posted January 25, 2007 I'd check your variables you refer to $user[color=red][b]s[/b][/color]['posX'][/b] and then $user['posY'])I'm guessing both should be $user as thats the same array for holding the username Quote Link to comment Share on other sites More sharing options...
R1der Posted January 25, 2007 Author Share Posted January 25, 2007 Thx for the reply but i tried $user before i changed it to $users Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted January 25, 2007 Share Posted January 25, 2007 OK, my advice would be to a) separate the parts of the if statement for readability, b) change the short <? tags for <?php and c) check that your variable names are consistent, as identified by Tyche.[code]<?phpif(($user['wilderness'] == 1) && ($ir['posX'] == $users['posX']) && ($ir['posY'] == $users['posY'])){ echo $user['username'];}?>[/code]Also, check the case sensitivity.If all this fails then we may need a little bit more of the code.RegardsHuggie 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.