I am trying to do what I think should be quite simple, which is to restrict user by "account type". I have setup a system based on Kevin Yank's "Manage Users with PHP Sessions" tutorial. I have added a field in my working database table, called "usertype" and added it to the registration page (data gets inserted into database, verified by checking MySQLAdmin).
I might add that I am using "enum" and pre-defined values (a.b.c) for my usertypes. Here is my sql:
PHP Code:
CREATE TABLE `user` (
  `
IDint(11NOT NULL auto_increment,
  `
useridvarchar(100NOT NULL,
  `
passwordchar(16NOT NULL,
  `
fullnamevarchar(100NOT NULL,
  `
emailvarchar(100NOT NULL,
  `
notestext,
  `
usertypeenum('a','b','c'NOT NULL default 'b',
  
PRIMARY KEY  (`ID`),
  
UNIQUE KEY `userid` (`userid`)
ENGINE=MyISAM AUTO_INCREMENT=DEFAULT CHARSET=latin1 AUTO_INCREMENT=
So, on my restricted-access pages, I need to check if they are the proper user type, or let them know what the problem is. Here is my PHP:
PHP Code:
$sql mysql_query("SELECT usertype FROM user WHERE id='$userid'"); 
while(
$row mysql_fetch_array($sql)){
$usertype $row["usertype"];
}
if (
$usertype == "a") {
    
$userOptions "You get options for Normal User";
} else if (
$usertype == "b") {
    
$userOptions "You get options for Expert User";
} else {
    
$userOptions "You get options for Super User";
}
?> 
My user is registered as an "a" user, but I get the output: "You get options for a Super User" every time. I have tried to echo usertype in my HTML, but get no output (null). So, somehow, my retrieval script is not doing the job. Any help or suggestions?