Jump to content

refuring to other users in the table


R1der

Recommended Posts

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 shows

You are currently at (0,0)

North
West          East
South

You are see:
*****(here is where it should show the users)*****


Hope this makes sence
Link to comment
https://forums.phpfreaks.com/topic/35641-refuring-to-other-users-in-the-table/
Share on other sites

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.

Regards
Huggie
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]<?php
if(($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.

Regards
Huggie

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.