//RunQuery("LOCK TABLES person_per WRITE, person_custom WRITE"); $sSQL = "UPDATE person_per SET per_FirstName='" . $aFirstNames[$iCount] . "', per_MiddleName='" . $aMiddleNames[$iCount] . "',per_LastName='" . $aLastNames[$iCount] . "',per_Suffix='" . $aSuffix[$iCount] . "',per_Gender='" . $aGenders[$iCount] . "',per_fmr_ID='" . $aRoles[$iCount] . "',per_BirthMonth='" . $aBirthMonths[$iCount] . "',per_BirthDay='" . $aBirthDays[$iCount] . "', " . $sBirthYearScript . "per_cls_ID='" . $aClassification[$iCount] . "' WHERE per_ID=" . $aPersonIDs[$iCount]; RunQuery($sSQL); //RunQuery("UNLOCK TABLES"); } } } // Update the custom person fields. if ($numCustomFields > 0) { $sSQL = "REPLACE INTO family_custom SET "; mysql_data_seek($rsCustomFields, 0); while ($rowCustomField = mysql_fetch_array($rsCustomFields, MYSQL_BOTH)) { extract($rowCustomField); if ($aSecurityType[$fam_custom_FieldSec] == 'bAll' or $_SESSION[$aSecurityType[$fam_custom_FieldSec]]) { $currentFieldData = trim($aCustomData[$fam_custom_Field]); sqlCustomField($sSQL, $type_ID, $currentFieldData, $fam_custom_Field, $sCountry); } } // chop off the last 2 characters (comma and space) added in the last while loop iteration. $sSQL = substr($sSQL, 0, -2); $sSQL .= ", fam_ID = " . $iFamilyID; //Execute the SQL RunQuery($sSQL); } //Which submit button did they press? if (isset($_POST["FamilySubmit"])) { //Send to the view of this person Redirect("FamilyView.php?FamilyID=" . $iFamilyID); } else { //Reload to editor to add another record Redirect("FamilyEditor.php");
if ($aColumnCustom[$col]) { $currentType = $aCustomTypes[$aColumnID[$col]]; $currentFieldData = trim($aData[$col]); // If date, first parse it to the standard format.. if ($currentType == 2) { $aDate = ParseDate($currentFieldData, $iDateMode); $currentFieldData = implode("-", $aDate); } elseif ($currentType == 1) { if (strlen($currentFieldData)) { $currentFieldData = ConvertToBoolean($currentFieldData) + 1; } } else { $currentFieldData = addslashes($currentFieldData); } // aColumnID is the custom table column name sqlCustomField($sSQLcustom, $currentType, $currentFieldData, $aColumnID[$col], $sCountry); } } // Finalize and run the update for the person_custom table. $sSQLcustom = substr($sSQLcustom, 0, -2); $sSQLcustom .= " WHERE per_ID = " . $iPersonID; RunQuery($sSQLcustom); //echo "<br>" . $sSQLcustom . "<br>"; } $importCount++; } fclose($pFile); // delete the temp file unlink($csvTempFile); $iStage = 3; } else {
if ($bGetKeyBack) { $sSQL = "SELECT MAX(per_ID) AS iPersonID FROM person_per"; $rsPersonID = RunQuery($sSQL); extract(mysql_fetch_array($rsPersonID)); $sSQL = "INSERT INTO `person_custom` (`per_ID`) VALUES ('" . $iPersonID . "')"; RunQuery($sSQL); } // Update the custom person fields. if ($numCustomFields > 0) { mysql_data_seek($rsCustomFields, 0); $sSQL = ""; while ($rowCustomField = mysql_fetch_array($rsCustomFields, MYSQL_BOTH)) { extract($rowCustomField); if ($aSecurityType[$custom_FieldSec] == 'bAll' or $_SESSION[$aSecurityType[$custom_FieldSec]]) { $currentFieldData = trim($aCustomData[$custom_Field]); sqlCustomField($sSQL, $type_ID, $currentFieldData, $custom_Field, $sPhoneCountry); } } // chop off the last 2 characters (comma and space) added in the last while loop iteration. if ($sSQL > "") { $sSQL = "REPLACE INTO person_custom SET " . $sSQL . " per_ID = " . $iPersonID; //Execute the SQL RunQuery($sSQL); } } // Check for redirection to another page after saving information: (ie. PersonEditor.php?previousPage=prev.php?a=1;b=2;c=3) if ($sPreviousPage != "") { $sPreviousPage = str_replace(";", "&", $sPreviousPage); Redirect($sPreviousPage . $iPersonID); } else { if (isset($_POST["PersonSubmit"])) {