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 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 Display Modes
  #1 (permalink)  
Old August 18th, 2010, 11:59 AM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default Chapter 3 using Ready Made Databases

Hi I have been racking my brains trying to figure out whats wrong with my script any help would be appreciated. Thanks.

I am going through pages 94-96

Here is my moviedata script

Code:
//insert data into movie table
$insert = "INSERT INTO movie (movie_id,movie_name,movie_type,
		movie_year,movie_leadacor,movie_director)
		VALUES (1, 'Bruce Almighty', 5,2003,1,2),
		(2,'Office Space',5,1999,5,6),
		(3,'Grand Canyon',2,1991,4,3)";

$results =mysql_query($insert)
	or die(mysql_error());

//insert datat in "movietype" table
$type = "INSERT INTO movietype (movietype_id,movietype_label)
			VALUES (1,'Sci Fi'),
			(2, 'Drama'),
			(3, 'Adventure'),
			(4, 'War'),
			(5, 'Comedy'),
			(6, 'Horror'),
			(7, 'Action'),
			(8, 'Kids')";

$results =mysql_query($type)
	or die(mysql_error());

//insert data into "people" table
$people ="INSERT INTO people (people_id,people_fullname,
			people_isactor,people_isdirector)
			VALUES (1, 'Jim Carrey',0,1),
			(2, 'Tom Shadyac',0,1),
			(3, 'Lawerence Kasdan', 0,1),
			(4, 'Kevin Kline', 1,0),
			(5, 'Ron Livingston', 1,0),
			(6, 'Mike Judge',0,1)";

$results =mysql_query($people)
	or die(mysql_error());

echo "Data inserted succesfully!";
?>
I keep getting the following

Duplicate entry '1' for key 1
Reply With Quote
  #2 (permalink)  
Old August 18th, 2010, 01:47 PM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Please close I got it figured out.
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
Chapter 16 - Accessing Databases error ldgotz BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 8 February 6th, 2010 01:18 AM
ready vs. ready phrnck@mac.com BOOK: Beginning JavaScript and CSS Development with jQuery 1 August 14th, 2009 03:05 PM
Beginning VB6 Databases - Chapter 2 Mark65 VB Databases Basics 1 December 18th, 2003 07:08 PM



All times are GMT -4. The time now is 06:55 PM.


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