0

Please some body help me verified many times but i couldn't find where i did a mistake

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'Index_6'

This is my code:

$first_name = $_POST ['firstName'];
$middle_name = $_POST ['middleName'];
$last_name = $_POST ['lastName'];
$office_ph_no = $_POST ['officePhoneNumber'];
$cell_ph_no = $_POST ['cellPhoneNumber'];
$email = $_POST ['emailId'];
$supervisor_name = $_POST ['supervisorName'];
$supervisor_email = $_POST ['supervisorEmail'];
$supervisor_ph = $_POST ['supervisorPhone'];
$pass = $_POST ['password'];

$sql = $db->query ( "INSERT INTO user( user_id, title, first_name, last_name, user_identity_id, email_id, password, office_phone_number, public_id, session_id, address_id, created_by, last_modified_by, created_on, last_modified_on, is_activated, is_deprecated, middle_name, cell_phone_number, superviser_name, superviser_email, superviser_phone_number) 

VALUES ( :p_user_id, :p_title, :p_first_name, :p_last_name, :p_user_identity_id, :p_email_id, :p_password, :p_office_phone_number, :p_public_id, :p_session_id, :p_address_id, :p_created_by, :p_last_modified_by, :p_created_on, :p_last_modified_on, :p_is_activated, :p_is_deprecated, :p_middle_name, :p_cell_phone_number, :p_superviser_name, :p_superviser_email, :p_superviser_phone )",

   array (
'p_user_id' => '',
'p_title' => NULL,
'p_first_name' => $first_name,
'p_last_name' => $last_name,
'p_user_identity_id' => 'id',
'p_email_id' => $email,
'p_password' => $pass,
'p_office_phone_number' => $office_ph_no,
'p_public_id' => NULL,
'p_session_id' => NULL,
'p_address_id' => NULL,
'p_created_by' => NULL,
'p_last_modified_by' => NULL,
'p_created_on' => '',
'p_last_modified_on' => '',
'p_is_activated' => '0',
'p_is_deprecated' => '0',
'p_middle_name' => $middle_name,
'p_cell_phone_number' => $cell_ph_no,
'p_superviser_name' => $supervisor_name,
'p_superviser_email' => $supervisor_email,
'p_superviser_phone' => $supervisor_ph 
)
1
  • 1
    Which column has the constraint? Is it some of columns that you try to put NULL value, or column that you try to populate with value from $_POST? Commented Jan 12, 2012 at 10:59

1 Answer 1

1

In array the name 'p_ is_deprecated' has a blank space.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for identifying after changing that i'm getting Integrity constraint violation: 1062 Duplicate entry '' for key 'Index_6' this error
In your db this primary key (Index_6) is already in use for another supervisor (I supose is supervisor) verify it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.