Mr. R Posted September 1, 2007 Share Posted September 1, 2007 Hi, i have this annoying little problem when trying to see the rank of a user, this is the simple bit of code im using... $result = (mysql_query("SELECT rank FROM users WHERE username = '$username'")); if ($result == "admin") { echo "You are an admin."; }else{ echo "You are not an admin"; echo $result; } Even though the user is an admin, the output i get is... "You are not an adminResource id #5" Can anyone help me? Thanks Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 1, 2007 Share Posted September 1, 2007 <?php $result = mysql_query("SELECT rank FROM users WHERE username = '$username'"); $row = mysql_fetch_assoc($result); if ($row['rank'] == "admin") { echo "You are an admin."; }else{ echo "You are not an admin"; echo $row['rank']; } ?> Quote Link to comment Share on other sites More sharing options...
Mr. R Posted September 1, 2007 Author Share Posted September 1, 2007 Yes! it works, thanks a lot mate, its been annoying me for ages. 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.