Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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 March 17th, 2005, 01:10 PM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default cannot create table

Hi
I am new in PHP & MySQL, when i work with the coding from page 129, i cannot create the reviews table. My code is:

<?php
//connect to MySQL
$connect = mysql_connect("localhost", "root", "mysqlpass") or
die ("Hey loser, check your server connection.");
mysql_select_db ("wiley");


//create "reviews" table
$reviews = "CREATE TABLE reviews (
    review_movie_id int(11) NOT NULL,
    review_date date NOT NULL,
    review_name varchar(255) NOT NULL,
    review_reviewer_name varchar(255) NOT NULL,
    review_comment varchar(255) NOT NULL,
    review_rating int(11) NOT NULL default 0,
    KEY (review_movie_id),
    ) TYPE=MyISAM";
$results = mysql_query($reviews)
or die (mysql_error());
//populate the "reviews" table

$insert = "INSERT INTO reviews
    review_movie_id, review_date, review_name,
    review_reviewer_name, review_comment, review_rating)
    VALUES
    ('1', '2003-08-02', 'This movie rocks!',
    'John Doe','I thought this was a great movie even though
    my girlfriend made me see it against my will.' ,'4'),
    ('1','2003-08-01','An okay movie',
    'Billy Bob','This was an okay movie. I liked Eraserhead better.','2'),
    ('1','2003-08-10','Woo hoo!',
    'Peppermint Patty','Wish I\'d have seen it sooner!','5'),
    ('2','2003-08-01','My favorite movie',
    'Marvin Marian','I didn\'t wear my flair to the movie but I loved
    it anyway.','5'),
    ('3','2003-08-01','An awesome time',
    'George B.','I liked this movie, even though I thought it was
    an informational video from our travel agent.','3')";

$insert_results = mysql_query($insert)
or die(mysql_error());
?>

The error message that I've got:
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 ') TYPE=MyISAM' at line 9

what's wrong with that, please help, thx






Similar Threads
Thread Thread Starter Forum Replies Last Post
Create generic XSL Template to create table Venkatachalapathy XSLT 5 March 11th, 2008 07:49 AM
Create a Table using ADOX JDrown Access VBA 7 April 12th, 2006 03:52 AM
Create table from another table using ADO Kaustav Pro VB Databases 0 October 15th, 2005 05:44 AM
Why can't create table? Edward King Oracle 2 July 20th, 2005 04:11 AM
Create a table jmss66 Classic ASP Basics 1 July 19th, 2005 12:50 PM





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