graham23s Posted October 13, 2007 Share Posted October 13, 2007 Hi Guys, i have made some small functions to get a users class: #################################################################################### # Get the logged in users class #################################################################################### function get_user_class($users_id) { ## query the db for the users class $QUC = "SELECT `user_class` FROM `membership` WHERE `id`='$users_id'"; $RUC = mysql_query($QUC) or die (mysql_error()); $R = mysql_fetch_array($RUC) or die (mysql_error()); $class = $R['user_class']; echo $class; return; } #################################################################################### # MOD #################################################################################### function MODERATOR() { echo "Moderator"; return; } #################################################################################### # MOD #################################################################################### function ADMIN() { echo "Site Administrator"; return; } when i test it, it displays the classes ok but does show an error if they arent the same! ## user class if(get_user_class($users_id) != MODERATOR()) { stderr("Error","Your not a moderator!"); include("includes/footer.php"); exit; } can anyone see what went wrong at all? thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/73143-solved-small-function-problem/ Share on other sites More sharing options...
kratsg Posted October 14, 2007 Share Posted October 14, 2007 change the second code (you have extra parantheses after the moderator ## user class if(get_user_class($users_id) != "MODERATOR") { stderr("Error","Your not a moderator!"); include("includes/footer.php"); exit; } Link to comment https://forums.phpfreaks.com/topic/73143-solved-small-function-problem/#findComment-368868 Share on other sites More sharing options...
graham23s Posted October 14, 2007 Author Share Posted October 14, 2007 ahh so it was thanks mate:) Graham Link to comment https://forums.phpfreaks.com/topic/73143-solved-small-function-problem/#findComment-368872 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.