0

I have created one webform in Drupal 7 in which some form components are present. But when I'm going to view that webform the components(fields) are not displayed. Then I checked in form setting that form was closed but when I'm going to change the form setting to open and saving that form I'm getting error "The website encountered an unexpected error. Please try again later". Then in dblog there was the following mysql error.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '39055' for key 1: INSERT INTO {webform} (nid, confirmation, confirmation_format, redirect_url, status, block, teaser, allow_draft, auto_save, submit_notice, submit_text, submit_limit, submit_interval, total_submit_limit, total_submit_interval) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14); Array ( [:db_insert_placeholder_0] => 39055 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => full_html [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => 0 [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => [:db_insert_placeholder_11] => -1 [:db_insert_placeholder_12] => -1 [:db_insert_placeholder_13] => -1 [:db_insert_placeholder_14] => -1 ) in drupal_write_record() (line 7194 of /home/indiawaterportal/public_html/includes/common.inc).

Please help me to solve this issue.

7
  • You have an auto-increment problem on your table. Check stackoverflow.com/questions/14872215/… . Commented May 9, 2014 at 11:40
  • I have given ID field type as auto increment and it's also a primary key. Then what is the problem there? Commented May 9, 2014 at 12:09
  • I've made mistake in previous comment- there is no any auto increment field in webform. No I'm not using custom webform. Commented May 9, 2014 at 12:21
  • It's not a question of webform fields, it's your webform nid. Commented May 9, 2014 at 12:22
  • Webform ID is auto increment field. Commented May 9, 2014 at 12:30

1 Answer 1

0

INSERT INTO {webform} (nid...

tries to insert the nid of the webform (got from auto-increment in the node table) in the {webform} table. So, every nid inserted in nid column of webform table should be unique. But it seems that the newly-created webform node got a nid that already exists in webform's nid column.

So I guess there's something wrong. Find that nid in webform table, see if it exists in node table, that must be the trick.

6
  • Yes, nid is there in the webform table. Then what's wrong there? Commented May 9, 2014 at 12:48
  • is 39055 also in webform table's nid column ? Commented May 9, 2014 at 12:49
  • yes 39055 is webform nid. Commented May 9, 2014 at 12:51
  • Then delete your form and re-build it... :( Commented May 9, 2014 at 12:53
  • But that's not the solution I think. Commented May 9, 2014 at 12:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.