p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 (http://p2p.wrox.com/forumdisplay.php?f=160)
-   -   Chapter 3 using Ready Made Databases (http://p2p.wrox.com/showthread.php?t=80560)

hozdaman August 18th, 2010 10:59 AM

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

hozdaman August 18th, 2010 12:47 PM

Please close I got it figured out.


All times are GMT -4. The time now is 04:12 AM.

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