Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2005, 10:16 AM
Registered User
 
Join Date: Aug 2005
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
 
Old June 16th, 2006, 03:46 PM
Registered User
 
Join Date: Feb 2006
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!
 
Old June 17th, 2006, 05:20 AM
Registered User
 
Join Date: Feb 2006
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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.