Duplicate dbase entries with multiple insert behavior
Thanks for help with the single insert form. However, I can't figure out what I'm doing wrong trying to get the validation to work with the multiple insert behavior. Thanks
<?php require_once('../../Connections/basketball.php'); ?>
<?php require_once("../../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("../../WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("../../WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_girls_players = "-1";
if (isset($_POST['name'])) {
$colname_girls_players = (get_magic_quotes_gpc()) ? $_POST['name'] : addslashes($_POST['name']);
}
mysql_select_db($database_basketball, $basketball);
$query_girls_players = sprintf("SELECT * FROM girls_players WHERE name = %s", GetSQLValueString($colname_girls_players, "text"));
$girls_players = mysql_query($query_girls_players, $basketball) or die(mysql_error());
$row_girls_players = mysql_fetch_assoc($girls_players);
$totalRows_girls_players = mysql_num_rows($girls_players);?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "../validation/player_exists.html";
$_SESSION['WAVT_girlsplayersInsert_626_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM($totalRows_girls_players . "",-1,0,"",",.",false,1);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"girlsplayersInsert_626");
}
}
?>
<?php require_once('../../Connections/basketball.php');?>
<?php require_once('../../Connections/basketball.php');?>
<?php
// WA DataAssist Multiple Inserts
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
if (!session_id()) session_start();
$WA_loopedFields = array("name");
$WA_connection = $basketball;
$WA_table = "girls_players";
$WA_redirectURL = "girls_players_sResults.php";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "name";
$WA_columnTypesStr = "',none,''";
$WA_insertIfNotBlank = "name";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_basketball;
$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 = "".WA_AB_getLoopedFieldValue("name", $WA_multipleInsertCounter) ."";
$WA_fieldValues = explode("|", $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);
}
}
?>
<?php
// RepeatSelectionCounter_1 Initialization
$RepeatSelectionCounter_1 = 0;
$RepeatSelectionCounterBasedLooping_1 = true;
$RepeatSelectionCounter_1_Iterations = "20";
?>