My userlevels are stored as constants
//User Levels define('ADMIN', 4); define('MOD', 3); define('USER', 2); define('GUEST', 1); define('BANNED', 0);
My registration script stores these userlevel titles as a string to access later on during login and page security. Before I could say..
$results = mysql_query('some query'); $row = mysql_fetch_assoc($results); echo $row['userlevel'];
That should output like USER which is a constant so it really outputs 2 into the script. That's what it used to do but now it outputs USER, which is no good. I have to end up using
$user['level'] = constant($row['userlevel']);
Now this works but it's annoying because I never had to do this before... My question is, what is the best way to store a constant name in a DB then spit the value back out, not as a string, but as something the PHP parsing will automaticly parse as a constant?
Sorry if this is confusing.