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 November 25th, 2012, 01:02 AM
Registered User
 
Join Date: Nov 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 4 error on runtime

<?php
$db=mysql_connect("localhost","root","") or die("Unable to connect!Pls check your connection parameters.");
mysql_select_db(moviesite,$db) or die(mysql_error($db));


//alter the movie table to include time,cost and takings
$query='ALTER TABLE movie ADD COLUMN(
movie_running_time TINYINT UNSIGNED NULL,
movie_cost DECIMAL(4,1) NULL,
movie_takings DECIMAL(4,1) NULL)';
mysql_query($query,$db) or die(mysql_error($db));

//insert new data into the movie table for each movie
$query="UPDATE movie SET movie_running_time=111,movie_cost=81,movie_takings =242.6 WHERE movie_id=1";
mysql_query($query,$db) or die(mysql_error($db));

$query="UPDATE movie SET movie_running_time=87,movie_cost=10,movie_takings= 10.8 WHERE movie_id=2";
mysql_query($query,$db) or die(mysql_error($db));

$query="UPDATE movie SET movie_running_time=164,movie_cost=NULL,movie_takin gs=33.2 WHERE movie_id=3";
mysql_query($query,$db) or die(mysql_error($db));

echo "Movie database successfully updated";




?>







its giving error
Duplicate column name 'movie_running_time'
 
Old April 30th, 2013, 05:15 AM
Registered User
 
Join Date: Dec 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Thumbs up

Duplicate column name 'movie_running_time'
This error is occur because of their is some value or id of that column may be same.
check out the database and may be some value will be duplicate.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error from Chapter 11 Code winkle BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 April 22nd, 2009 02:41 PM
Chapter 20, p.987 Runtime Error Spasticus BOOK: Ivor Horton's Beginning Visual C++ 2005 0 January 17th, 2008 04:05 AM





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