本文整理匯總了PHP中DB_Update函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Update函數的具體用法?PHP DB_Update怎麽用?PHP DB_Update使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_Update函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _post_save_vote
function _post_save_vote(&$data, &$msg)
{
$msg->voteHash = md5(strtolower(substr($data['text'], 1)));
// but if this person already voted, we need to unregister these previous votes
DB_Update('UPDATE ' . getTableName('messages') . ' SET m_votehash = "", m_deleted = "Y" WHERE m_parent = ? AND m_author = ?', array($msg->parentKey, $msg->authorEntity->key()));
DB_Update('DELETE FROM ' . getTableName('votes') . ' WHERE v_msg = ?', array($msg->parentKey));
// update the vote summary
foreach (DB_GetList('SELECT COUNT(*) as votecount,m_data,m_id,m_votehash as count FROM ' . getTableName('messages') . '
WHERE m_parent = ? AND m_deleted = "N" AND m_type="post" AND m_votehash != ""
GROUP BY m_votehash') as $vds) {
$msgData = HubbubMessage::unpackData($vds);
// get the some exemplary votes for this
$voterList = array();
foreach (DB_GetList('SELECT m_author FROM ' . getTableName('messages') . ' WHERE m_parent = ? AND m_votehash = ? ORDER BY m_created DESC LIMIT 3', array($msg->parentKey, $vds['m_votehash'])) as $vex) {
$voterList[] = $vex;
}
// if this is also what this message votes for, add it to the list
if ($this->{$msg}->voteHash == $vds['m_votehash']) {
$voterList[] = getDefault($msg->authorKey, $msg->ownerKey);
}
// make the vote summary dataset
$voteDS = array('v_msg' => $msg->parentKey, 'v_choice' => $vds['m_votehash'], 'v_text' => $msgData['text'], 'v_voters' => implode(',', $voterList), 'v_count' => $vds['votecount']);
DB_UpdateDataset('votes', $voteDS);
}
}
示例2: DB_UpdateField
function DB_UpdateField($tableName, $rowId, $fieldName, $value)
{
if (is_array($value)) {
$value = $value[$fieldName];
}
$keys = DB_GetKeys($tableName);
DB_Update('UPDATE ' . getTableName($tableName) . ' SET `' . $fieldName . '` = "' . DB_Safe($value) . '" WHERE `' . $keys[0] . '` = ' . ($rowId + 0));
}
示例3: DB_Select
$Notice = DB_Select(SPrintF('%sOwners', $TableID), array('ID', 'UserNotice', 'UserID'), array('UNIQ', 'ID' => $RowID));
#-------------------------------------------------------------------------------
switch (ValueOf($Notice)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
#-------------------------------------------------------------------------------
if ($GLOBALS['__USER']['ID'] != $Notice['UserID']) {
if (!$GLOBALS['__USER']['IsAdmin']) {
return ERROR | @Trigger_Error(700);
}
}
#-------------------------------------------------------------------------------
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update($TableID, array('UserNotice' => $UserNotice), array('ID' => $RowID));
#-------------------------------------------------------------------------------
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例4: clearAllTables
function clearAllTables()
{
$this->skipView = true;
foreach(explode(',', 'auditlog,connections,entities,idaccounts,localgroups,messages,nvstore,servers,usagestats,users,votes') as $table)
DB_Update('TRUNCATE '.getTableName($table));
}
示例5: DB_Count
$ISPswLicenseID = (int) @$Args['ISPswLicenseID'];
$Flag = (string) @$Args['Flag'];
#$pricelist_id = (integer) @$Args['pricelist_id'];
#$period = (string) @$Args['period'];
#$addon = (integer) @$Args['addon'];
$IsInternal = (bool) @$Args['IsInternal'];
$IsUsed = (bool) @$Args['IsUsed'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Count = DB_Count('ISPswLicenses', array('ID' => $ISPswLicenseID));
if (Is_Error($Count)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (!$Count) {
return new gException('LICENSE_NOT_FOUND', 'Лицензия не найдена');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IISPswLicense = array('Flag' => $Flag, 'IsInternal' => $IsInternal, 'IsUsed' => $IsUsed);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('ISPswLicenses', $IISPswLicense, array('ID' => $ISPswLicenseID));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例6: Comp_Load
#-------------------------------------------------------------------------------
$IsAdd = Comp_Load('www/Administrator/API/TaskEdit', array('UserID' => $ISPswOrder['UserID'], 'TypeID' => 'ISPswSchemeChange', 'Params' => array($ISPswOrderID, $ISPswOrder['SchemeID'])));
#-------------------------------------------------------------------------------
switch (ValueOf($IsAdd)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('ISPswOrders', array('SchemeID' => $NewSchemeID), array('ID' => $ISPswOrderID));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'ISPswOrders', 'StatusID' => 'SchemeChange', 'RowsIDs' => $ISPswOrderID, 'Comment' => "Смена тарифа [" . $OldScheme['Name'] . "->" . $NewScheme['Name'] . "]"));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
#-------------------------------------------------------------------------------
if (Is_Error(DB_Commit($TransactionID))) {
示例7: DB_Select
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#обновляем HostingSchemes.HardServerID
$HostingSchemes = DB_Select('HostingSchemes', array('ID', 'HardServerID', 'tmpHardServerID'), array('Where' => '`HardServerID` > 0'));
#-------------------------------------------------------------------------------
switch (ValueOf($HostingSchemes)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
break;
case 'array':
#-------------------------------------------------------------------------------
foreach ($HostingSchemes as $HostingScheme) {
#------------------------------------------------------------------------------- $HS[$HostingServer['ID']] = $ServerID;
$IsUpdate = DB_Update('HostingSchemes', array('HardServerID' => $HS[$HostingScheme['tmpHardServerID']]), array('ID' => $HostingScheme['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsQuery = DB_Query('ALTER TABLE `HostingOrders` DROP FOREIGN KEY `HostingOrdersServerID`');
示例8: Call_User_Func_Array
#-------------------------------------------------------------------------------
$IsCreate = Call_User_Func_Array(array($VPSServer, 'Create'), $Args);
#-------------------------------------------------------------------------------
switch (ValueOf($IsCreate)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return $IsCreate;
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
# вносим адрес в базу
$IsUpdate = DB_Update('VPSOrders', array('IP' => $IsCreate['IP']), array('ID' => $VPSOrder['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error('[comp/Tasks/VPSCreate]: не удалось прописать IP адрес для виртуального сервера');
}
#-------------------------------------------------------------------------------
# вписываем адрес в массив, чтоб не лазить в базу
$VPSOrder['IP'] = $IsCreate['IP'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'VPSOrders', 'StatusID' => 'Active', 'RowsIDs' => $VPSOrder['ID'], 'Comment' => 'Заказ создан на сервере'));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
示例9: DB_Update
#-----------------------------------------------------------------------
$ExpirationDate = $Order['ExpirationDate'] + $Order['MinDaysPay'] * 86400;
#-----------------------------------------------------------------------
$IsUpdate = DB_Update($UniqID, array('ExpirationDate' => $ExpirationDate), array('ID' => $Order['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
}
break;
default:
return ERROR | @Trigger_Error(101);
}
#-----------------------------------------------------------------------------
foreach ($Balances as $ContractID => $Balance) {
#---------------------------------------------------------------------------
$IsUpdate = DB_Update($UniqID, array('Balance' => $Balance), array('Where' => SPrintF('`ContractID` = %u', $ContractID)));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
}
}
#-------------------------------------------------------------------------------
$Table[] = $Head;
#-------------------------------------------------------------------------------
foreach ($Incomes as $Income) {
#-----------------------------------------------------------------------------
$Line = array($Income['Customer'], $Income['Login'], $Income['Domain']);
#-----------------------------------------------------------------------------
for ($Month = $sMonth; $Month <= $sMonth + $Epoches; $Month++) {
#---------------------------------------------------------------------------
if (isset($Income[$Month])) {
示例10: switch
case 'ForProlong':
#-------------------------------------------------------------------------------
$IsProlong = $Server->DomainProlong($DomainOrder['DomainName'], $DomainOrder['DomainZone'], (int) $DomainOrder['YearsRemainded'], $DomainOrder['PersonID'], $DomainOrder['DomainID']);
#-------------------------------------------------------------------------------
switch (ValueOf($IsProlong)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору');
case 'false':
return 300;
case 'array':
#-------------------------------------------------------------------------------
$Task['Params']['TicketID'] = $IsProlong['TicketID'];
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('Tasks', array('Params' => $Task['Params']), array('ID' => $Task['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'DomainOrders', 'StatusID' => 'OnProlong', 'RowsIDs' => $DomainOrderID, 'Comment' => 'Регистратор принял заявку на продление доменного имени'));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
return 300;
default:
return ERROR | @Trigger_Error(101);
示例11: array
#-------------------------------------------------------------------------------
case 'true':
#-------------------------------------------------------------------------------
if (isset($IsInternal)) {
#-------------------------------------------------------------------------------
if (In_Array($DomainOrder['StatusID'], array('Active', 'Suspended', 'ForTransfer', 'OnTransfer'))) {
#-------------------------------------------------------------------------------
# add admin message
$Event = array('UserID' => 1, 'PriorityID' => 'Error', 'Text' => SPrintF('Домен %s.%s является свободным, невозможно обновить информацию WhoIs', $DomainOrder['DomainName'], $DomainOrder['SchemeName']), 'IsReaded' => $IsReaded);
$Event = Comp_Load('Events/EventInsert', $Event);
if (!$Event) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
# update last whois update date
$IsUpdate = DB_Update('DomainOrders', array('UpdateDate' => Time()), array('ID' => $DomainOrder['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
return new gException('DOMAIN_IS_FREE', SPrintF('Доменное имя %s.%s является свободным', $DomainOrder['DomainName'], $DomainOrder['SchemeName']));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例12: array
#-------------------------------------------------------------------------------
# заказ ссылается на несуществующую лицензию. вывешиваем ахтунг
$Event = array('UserID' => 100, 'PriorityID' => 'Error', 'Text' => SPrintF('Заказ ПО #%s ссылается на несуществующую лицензию #%s', $ISPswOrder['OrderID'], $ISPswOrder['LicenseID']), 'IsReaded' => FALSE);
$Event = Comp_Load('Events/EventInsert', $Event);
if (!$Event) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
case 'array':
#-------------------------------------------------------------------------------
if ($License['IP'] != $ISPswOrder['IP']) {
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('ISPswOrders', array('IP' => $License['IP']), array('ID' => $ISPswOrder['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
示例13: array
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$UCollation = array('IsActive' => $IsActive, 'Source' => $Source, 'Destination' => $Destination, 'Image' => $Image, 'Prompt' => $Prompt, 'Description' => $Description, 'AdminNotice' => $AdminNotice, 'SortID' => $SortID);
#-------------------------------------------------------------------------------
#-----------------------------TRANSACTION---------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('CollationEdit')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Answer = array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($CollationID) {
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('PaymentSystemsCollation', $UCollation, array('ID' => $CollationID));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
$CollationID = DB_Insert('PaymentSystemsCollation', $UCollation);
if (Is_Error($CollationID)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Answer['CollationID'] = $CollationID;
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
示例14: DB_Update
#-------------------------------------------------------------------------------
if (IntVal($User['OwnerID']) > 0 && $PromoCode['ForceOwner'] || IntVal($User['OwnerID']) == 0) {
$IsUpdate = DB_Update('Users', array('OwnerID' => $PromoCode['OwnerID']), array('ID' => $GLOBALS['__USER']['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
}
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# считаем число заюзанных промокодов
$Count = DB_Count('PromoCodesExtinguished', array('Where' => SPrintF('`PromoCodeID` = %u', $PromoCode['ID'])));
if (Is_Error($Count)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
# обновляем число заюзанных промокодов
# TODO подумать надо ли это. можно просто SELECT по двум таблицам гонять и не парится
$IsUpdate = DB_Update('PromoCodes', array('CurrentAmount' => $Count), array('ID' => $PromoCode['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(DB_Commit($TransactionID))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return array('Status' => 'Ok');
#-------------------------------------------------------------------------------
示例15: DB_Update
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------
break;
case 'array':
# No more...
break;
default:
return ERROR | @Trigger_Error(101);
}
}
}
break;
default:
return ERROR | @Trigger_Error(101);
}
#---------------------------------------------------------------------------
$IsUpdate = DB_Update('Invoices', array('IsPosted' => TRUE), array('ID' => $Invoice['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------------------
if (Is_Error(DB_Commit($TransactionID))) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------------------
return TRUE;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------