[SOLVED] Wrist slap - database insert

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
papacharlie
Forum Newbie
Posts: 4
Joined: Thu Feb 17, 2005 3:02 am

[SOLVED] Wrist slap - database insert

Post by papacharlie »

OK I have been slapped , and using the help I got this error

"Duplicate entry 'BUSO203' for key 1"


$sql = "INSERT INTO subjects (unit_no, unit_name, result, sem, year) VALUES ('$_POST[unit_no]', '$_POST[unit_name]', '$_POST[result]', '$_POST[sem]', '$_POST[year]')";

Can anyone help

p.s. see previous post.

Thankyou
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Whichever column 'BUSO203' is going into is a unique/primary column which means every value must be unique. What type of column is it?
papacharlie
Forum Newbie
Posts: 4
Joined: Thu Feb 17, 2005 3:02 am

Post by papacharlie »

I fixed the problem using phpdn recomended help site http://www.hudzilla.org

That problem was a duplicate entry in MySQL.

The major problem was fixed using

// If the submit button has been pressed
if (isset($_POST['unit_no'])) {

instead of

// If the submit button has been pressed
if (isset($_POST['submit])) {
Post Reply