Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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 September 4th, 2004, 12:43 PM
nav nav is offline
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using PHP with MySQL

I am working through Beginning PHP, Apache, MySQL Web Development. I am on chapter 3 'using php with mysql'.

I have typed up the code as in the book into note pad. The book says to save the file as 'createmovie.php' which i done. I then typed up the code as in the book to enter data into the tables just created. I saved this file as 'moviedata.php'.

It then says to run the createmovie.php file in the browser which i done. All i saw was the code i just type up. Is this right?

It then says to run the moviedata.php file. When i do this i don't get a success message instead i get "Duplicate entry '1' for key 1".
what does this mean?

I really don't know whether or not my database has been created. I have checked the code and it looks okay.

Can somebody please help this is driving me crazy

Please


 
Old September 5th, 2004, 04:02 AM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default

Your question is also ambigous to me.
there are several option i can callup now for you

1. You must run php on server. First, copy your php file to a subfolder under webserver root. then type address of that file from your browser. To get right result your server must know how to handle php file. I think your webserver is not configured for executing php files. If you don't configure your webserver then you will get code that you wrote before as result. So first configure your webserver. I think how to configure webserver, you will get in the book details.
Or,
2. I think you have configured your webserver for php files as you get this message "Duplicate entry '1' for key 1". You get the whole code that you typed as result when you run 'createmovie.php' because you may not php code block with php tag <?php ....... ?>.
3. U have successfully executed php code and a database has been created and it has 1 table and at least one row of data. You are trying to insert duplicate data, that's why you get that message.

If these solution is not clear to you, you may chat with me. [email protected], [email protected]







Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP-MySql imhappy Beginning PHP 1 September 24th, 2008 05:44 AM
PHP and MySQL MiNdWaRp PHP How-To 0 May 14th, 2007 06:25 PM
MySQL/PHP Help blackout Beginning PHP 1 August 8th, 2006 07:49 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
MySQL/PHP Gyhth PHP Databases 3 May 27th, 2005 08:21 PM





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