MasterACE14 Posted December 21, 2007 Share Posted December 21, 2007 Morning Everyone, I have a script which I use to simply echo every users information into a table. That works fine. The problem I am having is I want to either display(for there money column in database) ?? or there actual money, depending on what your Covert Action is. So if they have a higher covert action then you do. Then it should display ?? in the table under money. But for some reason, it is just displaying there money, whether or not there covert is higher then yours. Any help is greatly appreciated like always <?php // Relevent code only while ($a_row = mysql_fetch_assoc( $result ) ) { $all_id = stripslashes($a_row['id']); $all_name = stripslashes($a_row['username']); $all_rank = stripslashes($a_row['rank']); $all_race = stripslashes($a_row['race']); $all_money = stripslashes($a_row['money']); if($player_covertaction >= $other_player_covertaction) { // can you see their money? $all_player_real_money = "$".number_format($all_money); } else { $all_player_real_money = "???"; } // I then echo $all_player_real_money; in the table ?> Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/82760-solved-wrong-value-being-echod-when-echoing-all-users-money/ Share on other sites More sharing options...
rarebit Posted December 22, 2007 Share Posted December 22, 2007 Where are these set? $player_covertaction $other_player_covertaction Quote Link to comment https://forums.phpfreaks.com/topic/82760-solved-wrong-value-being-echod-when-echoing-all-users-money/#findComment-420924 Share on other sites More sharing options...
MasterACE14 Posted December 22, 2007 Author Share Posted December 22, 2007 Thankyou Heaps rarebit, you just pointed out my problem, and the script now works fine! $other_player_covertaction didn't exist. and I needed the covertaction of every player. So here is my new working script: <?php while ($a_row = mysql_fetch_assoc( $result ) ) { $all_id = stripslashes($a_row['id']); $all_name = stripslashes($a_row['username']); $all_rank = stripslashes($a_row['rank']); $all_race = stripslashes($a_row['race']); $all_money = stripslashes($a_row['money']); $all_covertaction = stripslashes($a_row['covertaction']); if($player_covertaction >= $all_covertaction) { // can you see their money? $all_player_real_money = "$".number_format($all_money); } else { $all_player_real_money = "???"; } ?> added $all_covertaction to grab all users covert action. which is then used in the if. Thanks again. Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/82760-solved-wrong-value-being-echod-when-echoing-all-users-money/#findComment-420963 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.