Re: re:php debugging skills

From: Date: Sat, 27 Sep 2008 06:12:08 +0000
Subject: Re: re:php debugging skills
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-45477@lists.php.net to get a copy of this message
Fergus Gibson wrote:
On Fri, Sep 26, 2008 at 10:17 AM, muhsin <mrfroasty@gmail.com> wrote:
Im stuck with this on my early scripts that im experimenting.These are the echo of the SQL part: INSERT INTO movietype (movietype_id, movietype_label) VALUE (1, 'Sci Fi'), (2, 'Drama'), (3, 'Adventure'), (4, 'Comedy'), (5, 'Horror'), (6, 'Action'), (7, 'Kids')
    
The "INSTERT" error has already been addressed. This statement has a typo. MySQL has no idea what "INSTERT" means. The "Duplicate entry" error is referring to the fact that you are attempting to add a duplicate volume into a column that can contain only unique values. The column in question is your primary key or has a UNIQUE index set on it. If you run either query twice without clearing the data in the table, this is the response you will get. You could use an ENUM column in the people table to set the movie types and do away with the movie table entirely. You could use REPLACE instead of INSERT. REPLACE will act like INSERT if there key isn't found, or it will replace the row if the key is found. In many cases, you will be able to use AUTO_INCREMENT and DEFAULT when constructing a table with a unique integer primary key column. The documentation at mysql.com is your friend.
bingo thanks alot for spotting that, a life saver :-) ...i actually decided to go to sleep after that error.So now im fresh to start again my mission. Thanks for the tips, really appreciated guys regards, muhsin -- Extra details: OSS:Gentoo Linux-2.6.24 profile:amd64 Hardware:x86-64 msi geforce 8600GT asus p5k-se location:/home/muhsin language(s):C/C++,basic,VHDL,bash Typo:40WPM server(s) owned: ftp://muhsinzubeir.homeftp.net http://muhsinzubeir.homeftp.net

« previous php.db (#45477) next »