Jason, my insert script is not working. My date fields. It's inserting the date values into the database as 0000-00-00. Here is the code.
<?php
// WA DataAssist Multiple Inserts
if (isset($_POST["submit"]) || isset($_POST["submit_x"])) // Trigger
{
if (!session_id()) session_start();
$WA_loopedFields = array("day_of_week", "cost_code", "job_number", "hours");
$WA_connection = $PowerCMSConnection;
$WA_table = "employee_hours2";
$WA_redirectURL = "";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "employee_name|employee_number|week_starting|week_ending|day_of_week|cost_code|job_number|hours";
$WA_columnTypesStr = "',none,''|',none,''|',none,NULL|',none,NULL|',none,''|',none,''|',none,''|',none,''";
$WA_insertIfNotBlank = "day_of_week";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_PowerCMSConnection;
$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["employee_name"]))?$_POST["employee_name"]:"") ."" . $WA_AB_Split . "".((isset($_POST["employee_number"]))?$_POST["employee_number"]:"") ."" . $WA_AB_Split . "".((isset($_POST["pick-date-start"]))?$_POST["pick-date-start"]:"") ."" . $WA_AB_Split . "".((isset($_POST["pick-date-end"]))?$_POST["pick-date-end"]:"") ."" . $WA_AB_Split . "".WA_AB_getLoopedFieldValue("day_of_week", $WA_multipleInsertCounter) ."" . $WA_AB_Split . "".WA_AB_getLoopedFieldValue("cost_code", $WA_multipleInsertCounter) ."" . $WA_AB_Split . "".WA_AB_getLoopedFieldValue("job_number", $WA_multipleInsertCounter) ."" . $WA_AB_Split . "".WA_AB_getLoopedFieldValue("hours", $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);
}
}
?>