Page 1 of 1

[SOLVED] Wrist slap - database insert

Posted: Thu Feb 17, 2005 5:41 pm
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

Posted: Thu Feb 17, 2005 5:45 pm
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?

Posted: Thu Feb 17, 2005 6:58 pm
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])) {