I’ve been working for quite a while with PHP and MySQL, and what is happening to me is very weird. I really don’t know where it’s coming from. So want I want is to check if the the user that is logged in ($user set in init.php) is an admin by checking his row in the database. So I do the following:
if(isset($user)) {
$query = mysql_query('SELECT group FROM users WHERE name = "'. $user .'"');
while($row = mysql_fetch_assoc($query)) {
echo $row['group'];
}
}
Which gives me the error that mysql_fetch_assoc is not getting the valid resource, so it gets false when it shouldn’t. And when selecting and outputting something different then the row group it works fine. Here’s how my database looks and the 2 users that are in it: