Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 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 Display Modes
  #1 (permalink)  
Old August 1st, 2011, 02:00 AM
Registered User
 
Join Date: Apr 2011
Location: Sunny Ca
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Error running db_ch03-1.php on pg 87

After writing the two scripts and ran the first one.. I got an error stating that bp6am access denied to moviesite. I've got pass that by adding CREATE while granting privileges to bp6am under the root admin.
mysql.exe -u root -p test
password: ********** (whatever pw you entered back in ch1)
Code:
GRANT CREATE, SELECT, INSERT, UPDATE ON *.*
TO bp6am@localhost
IDENTIFIED BY "bp6ampass";
But now that I ran after making that correction, I get the following error:
Quote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' movie_name VARCHAR(255) NOT NULL, ' at line 2
The code is this:
Code:
//create the movie table
$query = 'CREATE TABLE movie (
        movie_id			INTEGER UNSIGNED       	NOT NULL, AUTO_INCREMENT,
        movie_name            	VARCHAR(255)                 	NOT NULL,
        movie_type            	TINYINT          			NOT NULL DEFAULT 0,
        movie_year            	SMALLINT UNSIGNED 		NOT NULL DEFAULT 0,
        movie_leadactor     	INTEGER UNSIGNED  		NOT NULL DEFAULT 0,
        movie_director       	INTEGER UNSIGNED  		NOT NULL DEFAULT 0,
        
        PRIMARY KEY (movie_id),
        KEY movie_type (movie_type, movie_year)
    )
    ENGINE=MyISAM';
mysql_query($query, $db) or die(mysql_error($db));

Did I missed something here? your input will be greatly appreciated.
__________________
thInk bIg
When coding, I use notepad2, but that's just me...
Reply With Quote
  #2 (permalink)  
Old August 2nd, 2011, 06:44 PM
Registered User
 
Join Date: Apr 2011
Location: Sunny Ca
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is so frustrating... I'm going to have to acquire another book to help me finish my project
__________________
thInk bIg
When coding, I use notepad2, but that's just me...
Reply With Quote
  #3 (permalink)  
Old August 2nd, 2011, 11:13 PM
Registered User
 
Join Date: Apr 2011
Location: Sunny Ca
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Solved one line of problem

Quote:
Originally Posted by coderadm View Post
//create the movie table
$query = 'CREATE TABLE movie (
movie_id INTEGER UNSIGNED NOT NULL, AUTO_INCREMENT,
This particular programming line we need to remove the comma (,) after NOT NULL so that means it should look like this

PHP Code:
//create the movie table
$query CREATE TABLE movie (
movie_id        INTEGER UNSIGNED      NOT NULL AUTO_INCREMENT
In order for the script to run...

Now the next error I'm getting is

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VACHAR(100) NOT NULL, PRIMARY KEY(movietype_id) ) ENG' at line 3
__________________
thInk bIg
When coding, I use notepad2, but that's just me...
Reply With Quote
  #4 (permalink)  
Old August 2nd, 2011, 11:38 PM
Registered User
 
Join Date: Apr 2011
Location: Sunny Ca
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Solved second line of problem

'VACHAR(100) NOT NULL, PRIMARY KEY(movietype_id) ) ENG'

This was a typo 'VARCHAR(100) fixed

I've successfully created my first database... ye!!!
__________________
thInk bIg
When coding, I use notepad2, but that's just me...
Reply With Quote
Reply


Thread Tools
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
Error on page 87 Nurul BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 2 February 1st, 2010 12:41 AM
error occured in exercise at pg.87 hafizaismail BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 1 January 22nd, 2010 12:26 PM
battling to get similar xml output in php in line 64-87 as in 31-63. Greywacke Pro PHP 1 December 31st, 2009 05:36 AM
Chapter 11 Pg 334 Running Balance JackalBW BOOK: Access 2003 VBA Programmer's Reference 0 November 29th, 2007 03:07 AM



All times are GMT -4. The time now is 07:28 PM.


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