CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • DB Error: constraint violation
Pages: [1]

Author Topic: DB Error: constraint violation  (Read 856 times)

emmy

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 0
  • CiviCRM version: 4.2.0
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
DB Error: constraint violation
August 14, 2014, 07:10:26 am
Hi

I added custom field to civievent for users registering to have an option of choosing between two offers.

Am currently running Drupal 7 and civicrm 4.2.0

I added custom field to civievent for users registering to have an option of choosing between two offers.

I did this through the use of profiles as I was advised from a forum post and everything worked brilliant.

The problem or error came about when a user tries to register for an the event and selects the between the two field option.

A blank page is returned with an error:

Sorry but we are not able to provide this at the moment.
DB Error: constraint violation
Return to home page.

Error details:
=> -3
     [message] => DB Error: constraint violation
     [mode] => 16
     [debug_info] => INSERT INTO civicrm_value_volunteer_type_11  ( select_volunteer_type_13,entity_id ) VALUES ( '12',104 ) ON DUPLICATE KEY UPDATE select_volunteer_type_13 = '12' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db1114980_drupal7_tgh_civicrm`.`civicrm_value_volunteer_type_11`, CONSTRAINT `FK_civicrm_value_volunteer_type_11_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) O)]
     [type] => DB_Error
     [user_info] => INSERT INTO civicrm_value_volunteer_type_11  ( select_volunteer_type_13,entity_id ) VALUES ( '12',104 ) ON DUPLICATE KEY UPDATE select_volunteer_type_13 = '12' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db1114980_drupal7_tgh_civicrm`.`civicrm_value_volunteer_type_11`, CONSTRAINT `FK_civicrm_value_volunteer_type_11_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) O)]
     [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_value_volunteer_type_11  ( select_volunteer_type_13,entity_id ) VALUES ( '12',104 ) ON DUPLICATE KEY UPDATE select_volunteer_type_13 = '12' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db1114980_test_tgh_civicrm`.`civicrm_value_volunteer_type_11`, CONSTRAINT `FK_civicrm_value_volunteer_type_11_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) O)]"]
)

« Last Edit: August 15, 2014, 08:13:11 am by emmy »

emmy

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 0
  • CiviCRM version: 4.2.0
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: DB Error: constraint violation
August 15, 2014, 10:08:22 am
Hi everyone

I found this link and it could be helpful to someone else out there.

I found it very useful: http://forum.civicrm.org/index.php?topic=26300.0

Cheers

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • DB Error: constraint violation

This forum was archived on 2017-11-26.