Hello guys,
have a nice day...
I've created function to test if the user is admin or not and return true or false depending on user
function isitadmin($userid) {
$query = mysql_query("SELECT * FROM users WHERE user_id = '". $userid ."' AND level = 1");
if (mysql_num_rows($query) > 0)
{
return true;
}
else
{
return false;
}
}
if I test this function seperatly in single page the output will be "1" if admin and "nothing" if regular user
but when I use it in php file , like code below:
<?php
if (isitadmin($user_id)) {// $user_id comes from DB
// show some admin activities
} else {
// show normal user activites
}
but it shows admin activities for everyone :(, whats wrong then ?