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.