markvaughn2006 Posted October 18, 2009 Share Posted October 18, 2009 This one has really got me stumped... I need to display everybody with the location =$userlocation and wanted_lvl=1. But.. I need to also somehow include an IF that will check a field from the mysql query against a field in the logged in users row.. So what this boils down to is I need to display everyone who's location equals $userlocation and wanted_lvl equals 1 but only show the people that who have less "stealth" than the logged in user has "vision". So it would show some people who have a lower stealth than your vision but it wouldn't show the people that have a higher stealth than your vision. <?php $result = mysql_query("SELECT user_name, location_message FROM users_tbl WHERE location='$userlocation' AND wanted_lvl='1'") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo '<form target="actions" method="post" action="includes/report.php"><input type="submit" value="Report" /><font color="red">'.$row['user_name'].'</font><input type="hidden" name="reported" value="'.$row['user_name'].'" /></form>'; } ?> Thanks for any help!! Sorry if this in the wrong forum, but it's more the php than the mysql i'm having a problem with Quote Link to comment Share on other sites More sharing options...
Alex Posted October 18, 2009 Share Posted October 18, 2009 If I'm understanding your correctly this can all, and should all be done within the query itself. eg. $result = mysql_query("SELECT user_name, location_message FROM users_tbl WHERE location='$userlocation' AND wanted_lvl='1' AND stealth < '$uservision'"); Where $uservision contains the vision value for the current user. Quote Link to comment Share on other sites More sharing options...
markvaughn2006 Posted October 18, 2009 Author Share Posted October 18, 2009 DOH! thanks man..... 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.