Hello all.

I have a form on my test site that I can't get set up. I set up the form, then publish it, then go to submit a test and I get the following error:

    * user warning: Duplicate entry '36' for key 1 query: INSERT INTO webform_submissions (nid, sid, uid, submitted, remote_addr) VALUES (329, 36, 1, 1229830850, '70.29.15.184') in /home/website/public_html/my-website/includes/database.mysql.inc on line 174.
    * user warning: Duplicate entry '36-1-0' for key 1 query: INSERT INTO webform_submitted_data (nid, sid, cid, no, data) VALUES (329, 36, 1, 0, 'Test tester') in /home/website/public_html/my-website/includes/database.mysql.inc on line 174.

After, I go to the components, and they are gone. This is a very simple form that has 3 components included. I have other forms on the site.

I do not have this problem on my live site. I have tried using phpmyadmin to export the webform tables and then import them to my test site and it has not worked. I can't do a full import of the Drupal database as I am doing some development on the test site that is not yet on the live site and I don't want to lose it. I have also uploaded the webform directory.

Any thoughts as to what else I can try? I'm not really much of a coder (other than html/css), so I'm at a bit of a loss.

Thanks for any help you can provide!

Shrill

Comments

shrill’s picture

Just adding a comment to say that I did it again, and this time the components remained. But I am still getting the error. The Duplicate entry number increases by 1 with each submit.

quicksketch’s picture

Category: bug » support

This is on Drupal 5? My guess is that your sequences table is screwed up. Drupal 5 keeps the current increment of sequences in this special table, and if it was not moved over the same time as you pulled in your Webform tables, they might be out of sync. A query like this might fix the problem:

$id = db_query("SELECT MAX(sid) FROM {webform_submissions}");
db_query("UPDATE {sequences} SET id = (%d) WHERE name = '{webform_submissions}_sid'");
shrill’s picture

Thanks for your help. Yes it is Drupal 5.

I'm trying this query in phpmyadmin and I get the following error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
$id = db_query("SELECT MAX(sid) FROM {webform_submissions}")' at line 1 

Thanks again!

quicksketch’s picture

That code I posted above is actually PHP code, with 2 SQL queries inside of it. If you need to do this all in a query (which using phpMyAdmin, you will), try this:

UPDATE sequences SET id = (SELECT MAX(sid) FROM webform_submissions) WHERE name = 'webform_submissions_sid';
shrill’s picture

It worked! Thanks so much!

quicksketch’s picture

Status: Active » Fixed

Hee, lucky guess. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.