Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 9th, 2005, 10:16 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old June 16th, 2006, 03:46 PM
Registered User
 
Join Date: Feb 2006
Location: , , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just discovered the same issue ... not found a way around it yet though!
Reply With Quote
  #3 (permalink)  
Old June 17th, 2006, 05:20 AM
Registered User
 
Join Date: Feb 2006
Location: , , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to set the ID column for the user_info table to Primary - then you can set it to auto_increment. You may need to update any data you have in this column to be unique before being able to set it to Primary.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in Chapter 12 JamesY BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 11th, 2006 03:49 PM
Chapter 12 Code Behind Problem locknload7 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 March 30th, 2005 10:34 AM
Chapter 12 problem JB977 BOOK: Beginning ASP 3.0 11 March 9th, 2004 08:27 AM
Table join problem Chapter 12, p 436 PHP-Beg tomasz BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 August 31st, 2003 12:56 PM
Chapter 12 problem Please help rsteph7 Beginning PHP 2 July 16th, 2003 02:02 PM



All times are GMT -4. The time now is 05:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.