Forums

db save not working with email

fisher12188 23 Oct, 2012
db save doesn't seem to be working since i put a email link in on submit. The form submits the email but the record is not recorded on the table for csv export. Please Help


[attachment=0]chronoform.png[/attachment]
GreyHead 23 Oct, 2012
Hi fisher12188,

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.

Bob
fisher12188 23 Oct, 2012
Data Array:

Array
(
    [option] => com_content
    [view] => article
    [id] => 193:annual-halloween-party-
    [catid] => 2:news
    [Itemid] => 25
    [chronoform] => KidsHalloweenParty
    [event] => submit
    [name] => Test Debugger
    [email] => adam@creativevisionzit.com
    [address] => 12188
    [number_of_kids] => 1
    [number_of_adults] => 1
    [submit] => Submit
    [456a336f3481804314a6ca3fa92f0080] => 1
    [layout] => default
    [chronoform_data] => Array
        (
            [cf_uid] => 6a11254db5ed40022241b8ed7c3de2f3
            [cf_created] => 2012-10-23 15:16:10
            [cf_created_by] => 0
            [cf_ipaddress] => 65.110.138.234
            [cf_user_id] => 0
            [option] => com_content
            [view] => article
            [id] => 193:annual-halloween-party-
            [catid] => 2:news
            [Itemid] => 25
            [chronoform] => KidsHalloweenParty
            [event] => submit
            [name] => Test Debugger
            [email] => adam@creativevisionzit.com
            [address] => 12188
            [number_of_kids] => 1
            [number_of_adults] => 1
            [submit] => Submit
            [456a336f3481804314a6ca3fa92f0080] => 1
            [layout] => default
        )

    [chronoform_data_cf_user_id] => 0
    [csv_link] => http://www.halfmoonfire.org/components/com_chronoforms/exports/KidsHalloweenParty/KidsHalloweenParty.csv
    [csv_count] => 1
    [csv_size] => 0.1
)

Validation Errors:

Array
(
)

Thank You for signing up for the Halloween Party.
Debug Data

    TableKidsHalloweenPartyForm::store failed - Duplicate entry '0' for key 1 SQL=INSERT INTO `KidsHalloweenPartyForm` ( `cf_user_id`,`name`,`address`,`number_of_kids`,`number_of_adults` ) VALUES ( '0','Test Debugger','12188','1','1' )
    CSV Export
        $download_export: 0
        $download_nosave: 0
        Save folder is:
        /home/content/a/j/e/ajenson32/html/halfmoonfire/components/com_chronoforms/exports/KidsHalloweenParty/
        $download_export: xxx
        $download_export: 0
        File name is:
        KidsHalloweenParty.csv
        $query: SELECT * FROM `KidsHalloweenPartyForm` ;
        1 records were found to export.
        Save link is:
        http://www.halfmoonfire.org/components/com_chronoforms/exports/KidsHalloweenParty/KidsHalloweenParty.csv
        File size is: 0.1 kb
    email
        11
            Result An email has been SENT successfully from (admin)admin@admin.com to andy@creativevisionzit.com
            Body
            Name 	Test Debugger
            Email 	adam@creativevisionzit.com
            Address 	64 Burton Ave Waterford NY 12188
            # of Kids 	1
            # of Adults 	1
            Attachments array ( )

EMAIL:

From: admin <admin@admin.com>
Date: October 23, 2012, 6:16:10 PM EDT
To: <andy@creativevisionzit.com>
Subject: Halloween Party Attendee
Name 	Test Debugger 
Email 	adam@creativevisionzit.com 
Address 	12188 
# of Kids 	1 
# of Adults 	1
fisher12188 23 Oct, 2012
it appears that every user id is 0, at least from what i can see
GreyHead 24 Oct, 2012
Hi fisher12188,

I'm not exactly sure what is happening here. Here's my bets interpretation - though it gets a bit technical:

[list]
  • It looks as though your table is using cd_user_id as the primary key?

  • As you say, this is always 0 - as it will be unless the form is completed by a logged in user.

  • Because the primary key is the same as the existing key the Database code tries to update the existing record; but 0 isn't allowed as a value for an auto-incrementing primary key so the update fails.
  • [/list]

    if this is correct then my suggestion is that you add a new id column to your table and set that as the auto-incrementing primary key. If there's only test data then you can just create a new table to do this.

    Bob
    GreyHead 24 Oct, 2012
    Hi fisher12188 ,

    You use PHPMyAdmin (or something similar). Or, as I suggested, you create a new table

    Bob
    This topic is locked and no more replies can be posted.