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 Link to comment https://forums.phpfreaks.com/topic/67571-solved-annoying-resource-id-5/ 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']; } ?> Link to comment https://forums.phpfreaks.com/topic/67571-solved-annoying-resource-id-5/#findComment-339397 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. Link to comment https://forums.phpfreaks.com/topic/67571-solved-annoying-resource-id-5/#findComment-339408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.