Dethman Posted July 9, 2008 Share Posted July 9, 2008 <?php if($player['raceID']==1){ $q = "select `username` from `user_users` where vote_count=(SELECT MAX(`vote_count`) FROM `user_users` where `raceID`='1')"; $leader = mysql_query($q) or trigger_error(mysql_error()); if( $leader ){ echo($leader); } else{ echo('None'); } } if($player['raceID']==2){ $q = "select `username` from `user_users` where vote_count=(SELECT MAX(`vote_count`) FROM `user_users` where `raceID`='2')"; $leader = mysql_query($q) or trigger_error(mysql_error()); if( $leader ){ echo($leader); } else{ echo('None'); } } if($player['raceID']==3){ $q = "select `username` from `user_users` where vote_count=(SELECT MAX(`vote_count`) FROM `user_users` where `raceID`='3')"; $leader = mysql_query($q) or trigger_error(mysql_error()); if( $leader ){ echo($leader); } else{ echo('None'); } } if($player['raceID']==4){ $q = "select `username` from `user_users` where vote_count=(SELECT MAX(`vote_count`) FROM `user_users` where `raceID`='4')"; $leader = mysql_query($q) or trigger_error(mysql_error()); if( $leader ){ echo($leader); } else{ echo('None'); } } ?> For Some reason this is not working right it displayes this Resource id #9 Please Help... :'( Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted July 9, 2008 Share Posted July 9, 2008 After doing a mysql_query, you have to use one of the mysql_fetch functions to actually get the data. For example: <?php if($player['raceID']==1){ $q = "select `username` from `user_users` where vote_count=(SELECT MAX(`vote_count`) FROM `user_users` where `raceID`='1')"; $leader = mysql_query($q) or trigger_error(mysql_error()); if(mysql_num_rows($leader) > 0 ){ $rw = mysql_fetch_assoc($leader); echo $rw['username']; } else{ echo 'None'; } } ?> Ken } Quote Link to comment Share on other sites More sharing options...
Wolphie Posted July 9, 2008 Share Posted July 9, 2008 Please mark your other topics as solved before creating a new very similar topic. Or, just update older topics. 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.