Chapter 12 - problem with "user_info" table
The problem I am having with the "user_info" table is that when a new user registers an account, the user id is allways "0". Is this by design? Shouldn't each user have a unique id like the admin accounts?
//create "user_info" table
$user_info = "CREATE TABLE user_info (
email varchar(50) NOT NULL,
username varchar(50) NOT NULL,
password varchar(255) NOT NULL,
first_name varchar(50) NOT NULL,
last_name varchar(50) NOT NULL,
city varchar(50) default NULL,
state varchar(50) default NULL,
hobbies varchar(255) default NULL,
id int(100) NOT NULL default '0',
)";
//create "admin" table
$admin = "CREATE TABLE admin (
username varchar(50) NOT NULL,
password varchar(255) NOT NULL,
first_name varchar(50) NOT NULL,
last_name varchar(50) NOT NULL,
email varchar(50) NOT NULL,
admin_level int(2) NOT NULL,
id int(100) NOT NULL auto_increment,
PRIMARY KEY (id),
)";
PHPMyAdmin tells me that there can only be one column with auto_increment. Has anyone else experienced this?
This is causing a problem later when I create the update_user.php on page 406. When I try to update the data for an individual user. The data for all users with id "0" gets updated.
Thanks for any help. -Ronald
|