本文整理匯總了PHP中DB_Query函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Query函數的具體用法?PHP DB_Query怎麽用?PHP DB_Query使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_Query函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: InsertSalesType
function InsertSalesType($SalesTypeDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
$FieldNames = '';
$FieldValues = '';
foreach ($SalesTypeDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
$sql = 'INSERT INTO salestypes (' . substr($FieldNames, 0, -2) . ') ' . 'VALUES (' . substr($FieldValues, 0, -2) . ') ';
if (sizeof($Errors) == 0) {
$result = DB_Query($sql, $db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例2: InsertGLAccountSection
function InsertGLAccountSection($AccountSectionDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($AccountSectionDetails as $key => $value) {
$AccountSectionDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyAccountSection($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors, $db);
if (isset($AccountSectionDetails['accountname'])) {
$Errors = VerifySectionName($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors);
}
$FieldNames = '';
$FieldValues = '';
foreach ($AccountSectionDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$sql = "INSERT INTO accountsection ('" . mb_substr($FieldNames, 0, -2) . "')\n\t\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "')";
$result = DB_Query($sql, $db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例3: InsertGLAccount
function InsertGLAccount($AccountDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($AccountDetails as $key => $value) {
$AccountDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyAccountCode($AccountDetails['accountcode'], sizeof($Errors), $Errors, $db);
if (isset($AccountDetails['accountname'])) {
$Errors = VerifyAccountName($AccountDetails['accountname'], sizeof($Errors), $Errors);
}
$Errors = VerifyAccountGroupExists($AccountDetails['group_'], sizeof($Errors), $Errors, $db);
$FieldNames = '';
$FieldValues = '';
foreach ($AccountDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$sql = "INSERT INTO chartmaster (" . mb_substr($FieldNames, 0, -2) . ") " . "VALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
$result = DB_Query($sql, $db);
$sql = "INSERT INTO chartdetails (accountcode,\n\t\t\t\t\t\t\tperiod)\n\t\t\t\tSELECT " . $AccountDetails['accountcode'] . ",\n\t\t\t\t\tperiodno\n\t\t\t\tFROM periods";
$result = DB_query($sql, $db, '', '', '', false);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例4: InsertSalesArea
function InsertSalesArea($AreaDetails, $User, $Password)
{
$Errors = array();
$db = db($User, $Password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
$Errors = VerifyAreaCodeDoesntExist($AreaDetails['areacode'], 0, $Errors, $db);
if (sizeof($Errors > 0)) {
// return $Errors;
}
$FieldNames = '';
$FieldValues = '';
foreach ($AreaDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
$sql = 'INSERT INTO areas (' . mb_substr($FieldNames, 0, -2) . ")\n\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
if (sizeof($Errors) == 0) {
$result = DB_Query($sql, $db);
if (DB_error_no() != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例5: InsertGLAccountGroup
function InsertGLAccountGroup($AccountGroupDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($AccountGroupDetails as $key => $value) {
$AccountGroupDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyAccountGroup($AccountGroupDetails['groupname'], sizeof($Errors), $Errors, $db);
$Errors = VerifyAccountSectionExists($AccountGroupDetails['sectioninaccounts'], sizeof($Errors), $Errors, $db);
if (isset($AccountGroupDetails['pandl'])) {
$Errors = VerifyPandL($AccountGroupDetails['pandl'], sizeof($Errors), $Errors);
}
$Errors = VerifyParentGroupExists($AccountGroupDetails['parentgroupname'], sizeof($Errors), $Errors, $db);
$FieldNames = '';
$FieldValues = '';
foreach ($AccountGroupDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$sql = 'INSERT INTO accountgroups (' . substr($FieldNames, 0, -2) . ') ' . 'VALUES (' . substr($FieldValues, 0, -2) . ') ';
$result = DB_Query($sql, $db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例6: generatenexlistFieldHTML
function generatenexlistFieldHTML($did, $row)
{
global $_CONF, $_TABLES;
$p = new Template($_CONF['path_layout'] . 'nexlist');
$p->set_file(array('fields' => 'definition_fields.thtml', 'field_rec' => 'definition_field_record.thtml'));
$p->set_var('definition_id', $did);
$p->set_var('rowid', $row);
$sql = "SELECT * FROM {$_TABLES['nexlistfields']} WHERE lid='{$did}' ORDER BY id";
$FLD_query = DB_Query($sql);
$numfields = DB_numrows($FLD_query);
if ($numfields > 0) {
$j = 1;
$p->set_var('show_fields', '');
while ($FLD = DB_fetchArray($FLD_query, false)) {
$edit_link = " [<a href=\"#\" onClick='editListField({$row},{$j});'>Edit</a> ]";
$del_link = " [<a href=\"#\" onClick='ajaxUpdateDefinition(\"deleteField\",{$row},{$j});'\">Delete</a> ]";
$p->set_var('field_recid', $FLD['id']);
$p->set_var('field_name', $FLD['fieldname']);
$p->set_var('field_value', $FLD['value_by_function']);
$p->set_var('field_width', $FLD['width']);
$p->set_var('field_id', $j);
$p->set_var('edit_link', $edit_link);
$p->set_var('delete_link', $del_link);
if ($FLD['predefined_function'] == 1) {
$checked = 'CHECKED';
$display_ftext = 'none';
$display_fddown = '';
$p->set_var('function_dropdown_options', nexlist_getCustomListFunctionOptions($FLD['value_by_function']));
} else {
$checked = '';
$display_ftext = '';
$display_fddown = 'none';
$p->set_var('function_dropdown_options', nexlist_getCustomListFunctionOptions());
}
$p->set_var('checked', $checked);
$p->set_var('display_ftext', $display_ftext);
$p->set_var('display_fddown', $display_fddown);
if ($j == 1) {
$p->parse('definition_field_records', 'field_rec');
} else {
$p->parse('definition_field_records', 'field_rec', true);
}
$j++;
}
$p->parse('definition_fields', 'fields');
} else {
$p->set_var('show_fields', 'none');
$p->set_var('definition_field_records', '');
}
$p->parse('output', 'fields');
$html = $p->finish($p->get_var('output'));
$html = htmlentities($html);
return $html;
}
示例7: DB_GetUsername
function DB_GetUsername($id)
{
$sql = "SELECT name FROM users WHERE id = {$id}";
$result = DB_Query($sql);
$name = "";
if ($result) {
$row = $result->fetch_assoc();
$name = $row["name"];
}
return $name;
}
示例8: generateTemplateVariableHTML
function generateTemplateVariableHTML($rec, $cntr)
{
global $_TABLES, $_CONF;
$p = new Template($_CONF['path_layout'] . 'nexflow/admin');
$p->set_file('variables', 'template_variables.thtml');
$p->set_file('variable_rec', 'template_variable_record.thtml');
$p->set_var('template_id', $rec);
$p->set_var('cntr', $cntr);
$sql = "SELECT * FROM {$_TABLES['nf_templatevariables']} WHERE nf_templateID='{$rec}' ORDER BY id";
$query = DB_Query($sql);
$numrows = DB_numrows($query);
if ($numrows > 0) {
$j = 1;
$p->set_var('show_vars', '');
$p->set_var('vdivid', '');
while ($A = DB_fetchArray($query)) {
$edit_link = "[ <a href=\"#\" onClick='ajaxUpdateTemplateVar(\"edit\",{$rec},{$cntr},{$j});'\">Edit</a> ]";
$del_link = "[ <a href=\"#\" onClick='ajaxUpdateTemplateVar(\"delete\",{$rec},{$cntr},{$j});'\">Delete</a> ]";
$p->set_var('variable_name', $A['variableName']);
$p->set_var('variable_value', $A['variableValue']);
$p->set_var('var_id', $j);
$p->set_var('edit_link', $edit_link);
$p->set_var('delete_link', $del_link);
if ($j == 1) {
$p->parse('template_variable_records', 'variable_rec');
} else {
$p->parse('template_variable_records', 'variable_rec', true);
}
$j++;
}
} else {
$p->set_var('show_vars', 'none');
$p->set_var('vdivid', "vars{$cntr}");
$p->set_var('template_variable_records', '');
}
$p->parse('output', 'variables');
$html = $p->finish($p->get_var('output'));
$html = htmlentities($html);
return $html;
}
示例9: SEC_checkTokenGeneral
function SEC_checkTokenGeneral($token, $action = 'general', $uid = 0)
{
global $_USER, $_TABLES, $_DB_dbms;
$return = false;
// Default to fail.
if ($uid == 0) {
$uid = $_USER['uid'];
}
if (trim($token) != '') {
$token = COM_applyFilter($token);
$sql = "SELECT ((DATE_ADD(created, INTERVAL ttl SECOND) < NOW()) AND ttl > 0) as expired, owner_id, urlfor FROM " . "{$_TABLES['tokens']} WHERE token='" . DB_escapeString($token) . "'";
$tokens = DB_Query($sql);
$numberOfTokens = DB_numRows($tokens);
if ($numberOfTokens != 1) {
if ($numberOfTokens == 0) {
COM_errorLog("CheckTokenGeneral: Token failed - no token found in the database");
} else {
COM_errorLog("CheckTokenGeneral: Token failed - more than one token found in the database");
}
$return = false;
// none, or multiple tokens. Both are invalid. (token is unique key...)
} else {
$tokendata = DB_fetchArray($tokens);
/* Check that:
* token's user is the current user.
* token is not expired.
*/
if ($uid != $tokendata['owner_id']) {
COM_errorLog("CheckTokenGeneral: Token failed - userid does not match token owner id");
$return = false;
} else {
if ($tokendata['expired']) {
$return = false;
} else {
if ($tokendata['urlfor'] != $action) {
COM_errorLog("CheckTokenGeneral: Token failed - token action does not match referer action.");
COM_errorLog("Token Action: " . $tokendata['urlfor'] . " - ACTION: " . $action);
if (function_exists('bb2_ban')) {
bb2_ban($_SERVER['REMOTE_ADDR'], 3);
}
$return = false;
} else {
$return = true;
// Everything is OK
}
}
}
}
} else {
$return = false;
// no token.
}
return $return;
}
示例10: DB_Query
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsQuery = DB_Query('ALTER TABLE `DomainSchemes` DROP `tmpServerID`');
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsQuery = DB_Query('ALTER TABLE `DomainSchemes` ADD KEY `DomainSchemesServerID` (`ServerID`)');
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsQuery = DB_Query('ALTER TABLE `DomainSchemes` ADD CONSTRAINT `DomainSchemesServerID` FOREIGN KEY (`ServerID`) REFERENCES `Servers` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE');
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(DB_Commit($TransactionID))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsFlush = CacheManager::flush();
if (!$IsFlush) {
@Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例11: DB_Query
if ($_GET['b'] == 'form') {
print "<center><table cellspacing=\"3\" cellpadding=\"0\"\n";
print "<tr><td align=\"center\" width=\"800\" colspan=\"2\"><h2>Envoi d'un mail</h2></td></tr>\n";
print "<form method=\"post\" action=\"espacereserve.php?p=connexion&w=enseignants&a=mail&b=envoi&mat=" . $_GET['mat'] . "\" >\n";
print "<tr><td align=\"left\"><b> Sujet </b></td><td><input class=\"defaultInput\" name=\"sujet\" size=\"40\"></td></tr>\n";
print "<tr><td colspan=\"2\" align=\"left\" ><b> Contenu</b></td></tr>\n";
print "<tr><td colspan=\"2\" align=\"left\"width=\"800\"><textarea class=\"defaultInput\" rows=\"10\" cols=\"50\" name=\"contenu\"></textarea><br><br></td></tr>\n";
print "<tr><td colspan=\"2\" align=\"left\"width=\"800\"><input class=\"defaultButton\" type=\"submit\" value=\"Envoyer\"\"> - <input class=\"defaultButton\" type=\"reset\" value=\"Annuler\"></td></tr>\n";
print "</form>\n";
print "</table></center>\n";
}
/* envoi */
if ($_GET['b'] == 'envoi') {
$requeteMail = DB_Query('SELECT Etudiant.email FROM Etudiant, Inscrit, Module, Matiere
WHERE (Etudiant.`id-etudiant` = Inscrit.`id-etudiant`)
and (Inscrit.`id-diplome` = Module.`id-diplome`)
and (Module.`id-module` = Matiere.`id-module`)
and (Matiere.`id-matiere` = "' . $_GET['mat'] . '")');
$entete = "FROM : " . $_SESSION['nom'] . " " . $_SESSION['prenom'] . " \n";
while ($tableau = mysql_fetch_array($requeteMail)) {
echo $tableau[0];
echo $_POST['sujet'];
echo $_POST['contenu'];
echo $entete;
mail($tableau['email'], $_POST['sujet'], $_POST['contenu'], $entete);
}
print "<table width=\"800\" cellspacing=\"3\" cellpadding=\"0\">\n";
print "<tr>\n";
print "<td align=\"center\" width=\"800\"><br>Votre mail a ete envoyé à tous les élèves avec succes. Redirection...</td>";
print "</tr>\n";
print "</table>\n";
示例12: trim
/* 刪除SQL串首尾的空白符 */
$sql = trim($sql);
/* 替換表前綴 */
$sql = preg_replace('/((TABLE|INTO|IF EXISTS)\\s+`)welive_/', '${1}' . $tableprefix, $sql);
/* 解析查詢項 */
$sql = str_replace("\r", '', $sql);
$query_items = explode(";\n", $sql);
foreach ($query_items as $query_item) {
/* 如果查詢項為空,則跳過 */
if (!$query_item) {
continue;
} else {
DB_Query($query_item);
}
}
DB_Query("INSERT INTO " . $tableprefix . "admin (aid, type, activated, username, password, email, first, fullname, fullname_en, post, post_en) VALUES (1, 1, 1, '{$username}', '" . md5($password) . "', '{$email}', '" . time() . "', '管理員', 'Admin', '係統管理員', 'Administrator')");
$thisfiledirname = strtolower(substr(str_replace(dirname(dirname(dirname(__FILE__))), '', dirname(dirname(__FILE__))), 1));
$script_name = strtolower($_SERVER['SCRIPT_NAME']);
if (strstr($script_name, $thisfiledirname . '/')) {
$thiswebsitedir = str_replace(strstr($script_name, $thisfiledirname . '/'), '', $script_name);
$SYSDIR = $thiswebsitedir . $thisfiledirname . '/';
} else {
$SYSDIR = '/';
}
$BaseURL = "http://" . $_SERVER['HTTP_HOST'] . $SYSDIR;
$filename = ROOT . "config/settings.php";
$fp = @fopen($filename, 'rb');
$contents = @fread($fp, filesize($filename));
@fclose($fp);
$contents = trim($contents);
$contents = preg_replace("/[\$]_CFG\\['BaseUrl'\\]\\s*\\=\\s*[\"'].*?[\"'];/is", "\$_CFG['BaseUrl'] = \"{$BaseURL}\";", $contents);
示例13: count
$lID = 1;
// Check if new logical Task ID = 0 - not allowed
}
// lets determine if there are any other tasks in this workflow.. otherwise we have to set the first task bit..
$sql = "SELECT count( * ) FROM {$_TABLES['nf_templatedata']} WHERE nf_templateID = '{$templateID}'";
$fields = 'logicalID, nf_templateID,nf_stepType, nf_handlerId, function, formid, optionalParm, firstTask, taskname, regenerate,reminderInterval';
if (DB_numRows(DB_Query($sql))) {
// no rows.. thus first task
$sql = "INSERT INTO {$_TABLES['nf_templatedata']} ({$fields}) ";
$sql .= "VALUES ('{$lID}','{$templateID}','{$stepID}','{$handlerID}','{$taskFunction}','{$task_formid}','{$optionalParm}',1,'{$taskName}','{$regen}','{$notifyinterval}')";
$result = DB_Query($sql);
$taskID = DB_insertID();
} else {
$sql = "INSERT INTO {$_TABLES['nf_templatedata']} ({$fields}) ";
$sql .= "VALUES ('{$lID}','{$templateID}','{$stepID}','{$handlerID}','{$taskFunction}','{$task_formid}','{$optonalParm}',0,'{$taskName}','{$regen}','{$notifyinterval}')";
$result = DB_Query($sql);
$taskID = DB_insertID();
}
// echo $sql;
}
// Update the timestamp - used to sort records if we have duplicates that need to be re-ordered
// Assume the latest updated record should have the logical ID entered - in case of new duplicate
DB_query("UPDATE {$_TABLES['nf_templatedata']} set last_updated = now() WHERE id='{$taskID}'");
// Check and see if we have any duplicate logical ID's and need to reorder
$sql = "SELECT id FROM {$_TABLES['nf_templatedata']} WHERE nf_templateID='{$templateID}' AND logicalID = '{$lID}'";
if (DB_numRows(DB_query($sql)) > 1) {
$sql = "SELECT id,logicalID FROM {$_TABLES['nf_templatedata']} WHERE nf_templateID='{$templateID}' ";
$sql .= "AND logicalID >= '{$lID}' ORDER BY logicalID ASC, last_updated DESC";
$query = DB_query($sql);
$id = $lID;
while ($A = DB_fetchArray($query)) {
示例14: DB_Query
}
// ---
if (!isset($content['ISERROR'])) {
// Everything was alright, go and check if the entry exists!
$result = DB_Query("SELECT FieldID FROM " . DB_FIELDS . " WHERE FieldID = '" . $content['FieldID'] . "'");
$myrow = DB_GetSingleRow($result, true);
if (!isset($myrow['FieldID'])) {
// Add custom Field now!
$sqlquery = "INSERT INTO " . DB_FIELDS . " (FieldID, FieldCaption, FieldDefine, SearchField, FieldAlign, DefaultWidth, FieldType, SearchOnline) \n\t\t\tVALUES (\n\t\t\t\t\t'" . $content['FieldID'] . "', \n\t\t\t\t\t'" . $content['FieldCaption'] . "',\n\t\t\t\t\t'" . $content['FieldDefine'] . "',\n\t\t\t\t\t'" . $content['SearchField'] . "',\n\t\t\t\t\t'" . $content['FieldAlign'] . "', \n\t\t\t\t\t" . $content['DefaultWidth'] . ", \n\t\t\t\t\t" . $content['FieldType'] . ", \n\t\t\t\t\t" . $content['SearchOnline'] . " \n\t\t\t\t\t)";
$result = DB_Query($sqlquery);
DB_FreeQuery($result);
// Do the final redirect
RedirectResult(GetAndReplaceLangStr($content['LN_FIELDS_HASBEENADDED'], DB_StripSlahes($content['FieldCaption'])), "fields.php");
} else {
// Edit the Search Entry now!
$result = DB_Query("UPDATE " . DB_FIELDS . " SET \n\t\t\t\tFieldCaption = '" . $content['FieldCaption'] . "', \n\t\t\t\tFieldDefine = '" . $content['FieldDefine'] . "', \n\t\t\t\tSearchField = '" . $content['SearchField'] . "', \n\t\t\t\tFieldAlign = '" . $content['FieldAlign'] . "', \n\t\t\t\tDefaultWidth = " . $content['DefaultWidth'] . ", \n\t\t\t\tFieldType = " . $content['FieldType'] . ", \n\t\t\t\tSearchOnline = " . $content['SearchOnline'] . "\n\t\t\t\tWHERE FieldID = '" . $content['FieldID'] . "'");
DB_FreeQuery($result);
// Done redirect!
RedirectResult(GetAndReplaceLangStr($content['LN_FIELDS_HASBEENEDIT'], DB_StripSlahes($content['FieldCaption'])), "fields.php");
}
}
}
if (!isset($_POST['op']) && !isset($_GET['op'])) {
// Default Mode = List Searches
$content['LISTFIELDS'] = "true";
// Copy Search array for further modifications
$content['FIELDS'] = $fields;
$i = 0;
// Help counter!
foreach ($content['FIELDS'] as &$myField) {
// Allow Delete Operation
示例15: ModifyBranch
//.........這裏部分代碼省略.........
}
if (isset($BranchDetails['address4'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address5'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address6'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['lat'])) {
$Errors = VerifyLatitude($BranchDetails['lat'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['lng'])) {
$Errors = VerifyLongitude($BranchDetails['lng'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['estdeliverydays'])) {
$Errors = VerifyEstDeliveryDays($BranchDetails['estdeliverydays'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['area'])) {
$Errors = VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['salesman'])) {
$Errors = VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['fwddate'])) {
$Errors = VerifyFwdDate($BranchDetails['fwddate'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['phoneno'])) {
$Errors = VerifyPhoneNumber($BranchDetails['phoneno'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['faxno'])) {
$Errors = VerifyFaxNumber($BranchDetails['faxno'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['contactname'])) {
$Errors = VerifyContactName($BranchDetails['contactname'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['email'])) {
$Errors = VerifyEmailAddress($BranchDetails['email'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['defaultlocation'])) {
$Errors = VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['taxgroupid'])) {
$Errors = VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['defaultshipvia'])) {
$Errors = VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['deliverblind'])) {
$Errors = VerifyDeliverBlind($BranchDetails['deliverblind'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['disabletrans'])) {
$Errors = VerifyDisableTrans($BranchDetails['disabletrans'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['brpostaddr1'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr2'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr3'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr4'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr5'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr6'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['specialinstructions'])) {
$Errors = VerifySpecialInstructions($BranchDetails['specialinstructions'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['custbranchcode'])) {
$Errors = VerifyCustBranchCode($BranchDetails['custbranchcode'], sizeof($Errors), $Errors);
}
$FieldNames = '';
$FieldValues = '';
foreach ($BranchDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
$sql = 'UPDATE custbranch SET ';
foreach ($BranchDetails as $key => $value) {
$sql .= $key . '="' . $value . '", ';
}
$sql = mb_substr($sql, 0, -2) . " WHERE debtorno='" . $BranchDetails['debtorno'] . "'\n AND branchcode='" . $BranchDetails['branchcode'] . "'";
if (sizeof($Errors) == 0) {
$result = DB_Query($sql, $db);
if (DB_error_no() != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}