close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple Records are not added.

Thread began 5/04/2016 8:48 am by Kumel | Last modified 5/05/2016 1:31 pm by Ray Borduin | 178 views | 4 replies |

Kumel

Multiple Records are not added.

I have a page where multiple records needs to be added but it is not adding multiple records. I tried multiple changes yet not able to fix it.

Page Attached.

Following code for inserting data:

<?php
// WA DataAssist Multiple Inserts
if (isset($_POST["submit"]) || isset($_POST["submit_x"])) // Trigger
{
if (!session_id()) session_start();
$WA_loopedFields = array("QuestionID", "Radio");
$WA_connection = $con1;
$WA_table = "JobAuditDetails";
$WA_redirectURL = "";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "JobID|QuestionID|Checked";
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|',none,''";
$WA_insertIfNotBlank = "";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_con1;
$WA_multipleInsertCounter = 0;
mysql_select_db($WA_connectionDB, $WA_connection);
while (WA_AB_checkMultiInsertLoopedFieldsExist($WA_loopedFields, $WA_multipleInsertCounter)) {
if ($WA_insertIfNotBlank == "" || WA_AB_checkLoopedFieldsNotBlank(array($WA_insertIfNotBlank), $WA_multipleInsertCounter)) {
$WA_fieldValuesStr = "".((isset($_POST["ID"]))?$_POST["ID"]:"") ."" . $WA_AB_Split . "".WA_AB_getLoopedFieldValue("QuestionID", $WA_multipleInsertCounter) ."" . $WA_AB_Split . "".WA_AB_getLoopedFieldValue("Radio", $WA_multipleInsertCounter) ."";
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
}
$WA_multipleInsertCounter++;
}
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>



Page screenshot also attached.

Sign in to reply to this post

Ray BorduinWebAssist

The code looks like it would work to me. Does the other insert and update code work correctly?

If you post a URL, steps to reproduce, and give me FTP access I can debug it and try to figure it out.

Sign in to reply to this post

Kumel

Others are working fine.

PM*

Sign in to reply to this post

Ray BorduinWebAssist

The multiple insert server behavior is supposed to create a hidden field based on the name of one of your repeated fields. However the hidden field on your page was named starting with "LockOutChecked" even though that wasn't a repeated form field on the page. My guess is that you renamed fields or removed them at some point (maybe moved from a checkbox to radio buttons) and didn't rename the hidden field properly.

I renamed it to start with the name of the other repeated field on your page: "QuestionID", and that appears to have solved the problem.

Sign in to reply to this post

Kumel

yes i had made some modifications. Well thanks.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...