Announcement

Collapse
No announcement yet.

The record cannot be inserted because these data have been already sent.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • The record cannot be inserted because these data have been already sent.

    Form App used. When entering the Donor Form I get the above error. When i re-enter the data the form goes through. On the Before Insert Event I do this check:

    if({pswd} != {confirm_pswd})
    {
    sc_error_message({lang_error_pswd});
    sc_error_exit();
    }
    {pswd} = md5({pswd});

    if({login} != {email})
    {
    sc_error_message('Error: Email does not match');
    sc_error_exit();
    }

    /**
    * Check for an existing Donor record
    */

    // SQL statement parameters
    $check_table = 'n_user_donors_and_admin'; // Table name
    $check_where = "Identity_Number = '{Identity_Number}'"; // Where clause

    // Check for record
    $check_sql = 'SELECT *'
    . ' FROM ' . $check_table
    . ' WHERE ' . $check_where;
    sc_select(dataset, $check_sql);

    if (false == {dataset})
    {
    // Error while accessing database
    }
    elseif ({dataset}->EOF)
    {
    // No Donor record found
    /**
    * Insert a record on another table
    */

    // SQL statement parameters
    $insert_table = 'n_user_donors_and_admin'; // Table name
    $insert_fields = array( // Field list, add as many as needed
    'E_mail' => "'{login}'",
    'First_Name' => "'{name}'",
    'Last_Name' => "'{surname}'",
    'Identity_Number' => "'{Identity_Number}'",
    'How_Did_You_Hear_About_Us' => "'{How_Did_You_Hear_About_Us}'",
    'Registration_Type' => "'Website'",
    'Date_Joined' => "'{Form_Date}'"
    );

    // Insert record
    $insert_sql = 'INSERT INTO ' . $insert_table
    . ' (' . implode(', ', array_keys($insert_fields)) . ')'
    . ' VALUES (' . implode(', ', array_values($insert_fields)) . ')';

    sc_exec_sql($insert_sql);
    }
    else
    {
    // Donor Record found
    sc_redir(control_donor_user_already_exists);
    }



    /**
    * Check for an existing User record
    */

    // SQL statement parameters
    $check_table = 'sec_v8_publicusers'; // Table name
    $check_where = "Identity_Number = '{Identity_Number}'"; // Where clause

    // Check for record
    $check_sql = 'SELECT *'
    . ' FROM ' . $check_table
    . ' WHERE ' . $check_where;
    sc_select(dataset, $check_sql);

    if (false == {dataset})
    {
    // Error while accessing database
    }
    elseif ({dataset}->EOF)
    {
    // No User record found


    }
    else
    {
    // User Record found
    sc_redir(control_donor_user_already_exists);
    }

    And on the After Insert This:

    send_mail_to_admin();
    send_mail_to_new_user();
    sc_commit_trans("conn_mysql");

    [name] = {name};
    [surname] = {surname};
    [email] = {login};
    [identity] = {Identity_Number};

    In desperation I even setup a link to try and force stability. Did not work.

  • #2
    Screen Shot

    Here is a Screenshot....
    Attached Files

    Comment


    • #3
      Hello phillipsa,

      "The record cannot be inserted because these data have been already sent.", I think this message means that the record is already saved.

      Are you using Scriptcase's default insert/save button to save the record?

      What table in the Database are you using in this form? Is it the table "n_user_donors_and_admin"? If it is, then that pretty much answer your question. The record is already saved Before Insert. But if it is not the case, then please give more information about the problem.

      Comment


      • #4
        Hi it is the stock standard insert button. What is worrying me is that message confuses the public. And is it not suppose to redirect even if the record was found with the sc_redir command I give the app?

        Comment


        • #5
          You didn't answer my question, "Is it the table "n_user_donors_and_admin"?" so I'll assume that I'm right.
          Then my answer is, No. It will not redirect because your code is in Before Insert which is literally before the record is inserted. It will detect that the record is not yet inserted so it will proceed to inserting the record and not in redirecting the form.

          Comment


          • #6
            If I were you I would check the generated code and see where the sc_commit_trans("conn_mysql"); occurs. I think it occurs once due to standard scriptcase code and once from your code.

            So your code does a commit in the OnBeforeInsert and then on the generated code when commit the data via your design.
            Check your generated source and it should become clear.

            I think (and I can be wrong of course) that this is the case.

            Comment


            • #7
              Hi Guys,

              No still Scriptcase issue.
              Last edited by phillipsa; 09-15-2015, 09:42 AM.

              Comment


              • #8
                Record Cannot be inserted.....

                This is now becoming an embarrassment to myself and my client. If we cannot get this sorted I will unfortunately look at better alternatives.
                Attached Files

                Comment


                • #9
                  i had same problem some moths ago, I think the problem is when Internet conection is not good. Did you tested the same form in your work? Show same error?

                  Comment


                  • #10
                    Hi Alvagar, On 10MB Line which is ok. Tried from other location same issue. I am now checking local and online databases to see if it is an ISP / ISP Config issue.

                    Comment


                    • #11
                      I had a client with these problems , but the other customers had no problem . I think you have to take into consideration ISP and hosting provider.

                      Comment


                      • #12
                        Update

                        Please see Screen Shots. When I go to Toolbar and Disable JavaScript Fields option I get a clearer error to the issue. I am sure this is a bug?????
                        Attached Files

                        Comment


                        • #13
                          I do not want to upload anything just submit the data to the Database.

                          Comment


                          • #14
                            @rr has mentioned, that ...

                            Code:
                            sc_commit_trans("conn_mysql");
                            ... is already done by sc. Delete this from your code and the error is gone.
                            Best regards: - Reinhard -

                            I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

                            Comment


                            • #15
                              Ok this error is back. And this time there is no SC_COMMIT_TRANS in the Code. This is getting a bit annoying now......

                              Comment

                              Working...
                              X