本文整理汇总了PHP中DB::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::Update方法的具体用法?PHP DB::Update怎么用?PHP DB::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Consume
static public function Consume($coupon,$store_id,$doer_id,$verifytype=4) {
if ( !$coupon['consume']=='N' ) return false;
$u = array(
'ip' => Utility::GetRemoteIp(),
'consume_time' => time(),
'consume' => 'Y',
'verifytype'=>$verifytype,
'store_id'=>$store_id,
'doer_id'=>$doer_id,
);
DB::Update('order',$coupon['order_id'],array('had_consume'=>1));
Table::UpdateCache('coupon', $coupon['id'], $u);
//判断是否点评返利成功,点评并返利成功的订单的消费券可以继续返利
$orderdp=DB::LimitQuery('order_dp',array(
'condition'=>array('order_id'=>$coupon['order_id'],'has_return'=>1)
));
if(!empty($orderdp)){
ZFlow::CreateFromCoupon($coupon);
}
ZCredit::CreateFromConsume($coupon);
return true;
}
示例2: update_order
function update_order($data)
{
if (!isset($data['order_id']) || !isset($data['express_no']) || !isset($data['express_id'])) {
return false;
}
$id = (int) $data['order_id'];
$express_no = $data['express_no'];
$express_id = $data['express_id'];
$order = DB::Update('order', array('id' => $id), array('express_no' => $express_no, 'express_id' => $express_id));
}
示例3: set_sms_api_options
function set_sms_api_options($sms_api_username, $sms_api_password, $sms_api_phone)
{
if ($sms_api_username !== '' && $sms_api_password !== '' && $sms_api_phone !== '') {
$fl1 = DB::Update('settings', 'sms_api_username', array('var' => $sms_api_username), 'name');
$fl2 = DB::Update('settings', 'sms_api_password', array('var' => $sms_api_password), 'name');
$fl3 = DB::Update('settings', 'sms_api_phone', array('var' => $sms_api_phone), 'name');
return $fl1 && $fl2 && $fl3;
} else {
return false;
}
}
示例4: logsearch
function logsearch()
{
global $DB, $C;
if (!isset($DB)) {
$DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']);
$DB->Connect();
}
if (preg_match_all('~[\'"]([^\'"]+)[\'"]|(\\b\\w+\\b)~', $_GET['s'], $matches)) {
$date = gmdate('Y-m-d H:i:s', _timewithtz());
foreach ($matches[0] as $match) {
$match = str_replace(array('"', '\''), '', $match);
if (strlen($match) < 4) {
continue;
}
if ($DB->Update('UPDATE `lx_search_terms` SET `searches`=`searches`+1,`date_last_search`=? WHERE `term`=?', array($date, $match)) < 1) {
$DB->Update('INSERT INTO `lx_search_terms` VALUES (?,?,?,?)', array(null, $match, 1, $date));
}
}
}
}
示例5: update
public function update()
{
$fields = func_get_args();
if (empty($fields)) {
return true;
}
$up_array = array();
foreach ($fields as $f) {
if (array_key_exists($f, $this->column_values)) {
$up_array[$f] = $this->column_values[$f];
}
}
if (empty($up_array)) {
return true;
}
return DB::Update($this->table_name, $this->pk_value, $up_array, $this->pk_name);
}
示例6: update
public function update($condition, $updateRow, $oldCondition = null, $actorType = 0, $actorID = 0)
{
if (!is_array($condition)) {
$tableID = $condition;
$condition = array($this->primaryKey => $condition);
}
$tableID = $tableID ? $tableID : $condition[$this->primaryKey];
$tableID = $tableID ? $tableID : $oldCondition[$this->primaryKey];
if ($this->hasUpdateTime) {
$updateRow['update_time'] = $updateRow['update_time'] ? $updateRow['update_time'] : time();
}
if ($tableID && !$oldCondition && $this->useLog && $this->logTable) {
$oldCondition = $this->fetch($tableID);
}
$result = DB::Update($this->tableName, $condition, $updateRow, $this->writeDB);
if ($result) {
$this->log($tableID, $oldCondition, $updateRow, DB_Log::TYPE_UPDATE, $actorType, $actorID);
} else {
$this->error = DB::$error;
}
return $result;
}
示例7: array
/* update order */
DB::Update('order', array('team_id' => $id), array(
'allowrefund' => $team['allowrefund'],
));
}
//dbx($team);
$insert = array_unique($insert);
$table = new Table('team', $team);
$table->SetStrip('detail', 'systemreview', 'notice', 'teambeizhu', 'teamviewb');
if ( $team['id'] && $team['id'] == $id ) {
$table->SetPk('id', $id);
$table->update($insert);
DB::Update('team',$id,array('dptpl_id'=>$_POST['dptpl_id']));
log_admin('team', '编辑team项目',$insert);
Session::Set('notice', '编辑项目信息成功');
redirect( WEB_ROOT . "/manage/team/index.php");
}
else if ( $team['id'] ) {
log_admin('team', '非法编辑team项目',$insert);
Session::Set('error', '非法编辑');
redirect( WEB_ROOT . "/manage/team/index.php");
}
if ( $table->insert($insert) ) {
log_admin('team', '新建team项目',$insert);
Session::Set('notice', '新建项目成功');
redirect( WEB_ROOT . "/manage/team/index.php");
示例8: unserialize
$DB->Connect();
// Check consistency of last_updates
$last_updates = unserialize(GetValue('last_updates'));
if ($DB->Count('SELECT COUNT(*) FROM `tlx_daily_stats` WHERE `date_stats`=?', array($last_updates['daily']))) {
// Update the daily value
$today = gmdate('Y-m-d', TIME_NOW);
$last_updates['daily'] = $today;
StoreValue('last_updates', serialize($last_updates));
}
// Load table data
IniParse("{$GLOBALS['BASE_DIR']}/includes/tables.php", TRUE, $table_defs);
// Load existing tables
$tables = $DB->GetTables();
// Create the tlx_account_ranks table
if (!isset($tables['tlx_account_ranks'])) {
$DB->Update("CREATE TABLE IF NOT EXISTS `tlx_account_ranks` ( {$table_defs['tlx_account_ranks']} ) TYPE=MyISAM");
}
// Create the tlx_account_ranks table
if (!isset($tables['tlx_account_category_ranks'])) {
$DB->Update("CREATE TABLE IF NOT EXISTS `tlx_account_category_ranks` ( {$table_defs['tlx_account_category_ranks']} ) TYPE=MyISAM");
}
// Update the tlx_categories table
$columns = $DB->GetColumns('tlx_categories', TRUE);
if (!isset($columns['page_url'])) {
$DB->Update('ALTER TABLE `tlx_categories` ADD COLUMN `page_url` TEXT AFTER `forward_url`');
}
// Update the tlx_daily_stats table
$columns = $DB->GetColumns('tlx_daily_stats', TRUE);
if (!isset($columns['clicks'])) {
$DB->Update('ALTER TABLE `tlx_daily_stats` ADD COLUMN `clicks` INT UNSIGNED NOT NULL');
}
示例9: update
function update()
{
if (User::is_admin()) {
$item_id = EClassApi::getParam('item_id');
$info = EClassApi::getParam('id');
if ($info == 'description') {
$value = Url::get('value');
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
require_once ROOT_PATH . 'includes/htmLawed.php';
$config = array('safe' => 1, 'elements' => '*', 'deny_attribute' => 'class, id');
$spec = 'a = title, href;';
// The 'a' element can have only these attributes
$value = htmLawed($value, $config, $spec);
$value = EClassApi::clean_value($value);
} else {
/* $value = EClassApi::cleanHtml(EClassApi::filter_title(Url::get('value')));
$value = EClassApi::trimSpace(str_replace("\n"," ",$value));
*/
$value = EClassApi::getParam('value');
mb_internal_encoding("UTF-8");
$value = mb_strtoupper(mb_substr($value, 0, 1)) . mb_substr($value, 1);
}
$info_array = array('name', 'description');
if (!in_array($info, $info_array)) {
die("no_info");
}
$row = Item::get_item($item_id);
$item_memcache = $row;
if ($info == 'description' && strlen(EClassApi::plainText(EClassApi::post_db_parse_html($value))) < 15) {
echo "unsuccess";
exit;
}
/* if(!User::is_foodnet_team()){
$arr_badwords = EClassApi::checkBadWord($value,true);
$value_badwords = $arr_badwords["bad"]."@enbac@".$arr_badwords["bad_key"];
if((strlen(trim($row['bad_words']))!=strlen(trim($value_badwords))) && strlen($arr_badwords["bad"])>0){
die('bad_content');
}
} */
//if( $item_id && User::is_login()){
if ($item_id) {
//if(($row["user_id"] == User::id() && !User::is_block()) || User::have_permit(ADMIN_ITEM) || User::have_cat_permit($row["category_id"])){
if ($info == 'name' && strlen($value) >= 5 && strlen($value) <= 150) {
$input = array('name' => $value);
$item_memcache['name'] = $value;
$output = $value;
if ($value != $row['name'] && $row['is_up_auto'] == 1) {
//Nếu thay đổi tên thì cập nhật cho cả lịch up tin
DB::query("UPDATE up_item_schedule SET des='{$value}' WHERE item_id=" . $row['id']);
}
} else {
if ($info == 'description') {
$sapo = EClassApi::word_limit(String::html2txt(EClassApi::post_db_parse_html($value)), 30, '');
$input = array('description' => $value, 'sapo' => $sapo);
$item_memcache['description'] = $value;
$output = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", "\$this->embeded('\$1','{$item_id}')", EClassApi::parseBBCode(Url::get('value')));
} else {
$input = array();
}
}
$item_memcache['modify_user_name'] = User::user_name();
$item_memcache['filter_des'] = "";
$input['modify_user_name'] = User::user_name();
if ($row["status"] == 2) {
$item_memcache['modify_time_user'] = TIME_NOW;
$input['modify_time_user'] = TIME_NOW;
}
if ($input) {
DB::Update('item', $input, "id='" . $item_id . "'");
///update realtime
if (SORL_FILTER_ON) {
$solr = new Solr_Search();
$solr->doUpdateItem($item_id);
}
//-----
if (MEMCACHE_ON) {
eb_memcache::do_put("item:{$item_id}", $item_memcache);
}
}
echo $output;
exit;
/* }
else{
die("no_permission");
} */
}
}
die("no_perm");
}
示例10: UpdateCache
public static function UpdateCache($n, $id, $r = array())
{
DB::Update($n, $id, $r);
return Cache::Del(Cache::GetObjectKey($n, $id));
}
示例11: template
//
$albumList = DB::LimitQuery('dp_album',array(
'condition'=>array('order_id'=>$order_id),
));
include template('manage_misc_dp_edit');
}
elseif($action == 'del'){
$order_id = $_GET['id'];
DB::Delete('order_dp_item',array('order_id'=>$order_id));
DB::Delete('order_dp',array('order_id'=>$order_id));
DB::Delete('dp_album',array('order_id'=>$order_id));
DB::Update('order',$order_id,array('had_dp'=>0));
Session::Set('notice', '删除成功');
redirect( WEB_ROOT . "/manage/misc/dp.php");
}
elseif ($action == 'delAlbum') {
$id = $_GET['id'];
$album = Table::Fetch("dp_album",$id);
$order_id = $album['order_id'];
DB::Delete("dp_album",array('id'=>$id));
@unlink('/static/'.$album['image']);
Session::Set('notice', '删除图片成功');
redirect( WEB_ROOT . "/manage/misc/dp.php?action=edit&id=".$order_id);
}
else{
$condition = array(
示例12: dirname
*/
require_once dirname(dirname(__FILE__)) . '/app.php';
$action = strval($_GET['action']);
/* 验证账户 */
if ($action == 'checkuser') {
$username = $_GET['u'];
$password = $_GET['p'];
$result = MCard::checkUser($username, $password);
if ($result) {
Session::Set('apply_card_real_u', $result['id']);
$arr_step_1 = array('user_id' => $result['id'], 'create_time' => time(), 'step' => 1);
DB::Insert('mcard', $arr_step_1);
$json = array('done' => true);
echo formatJSON($json);
die;
} else {
// 无信息
$json = array('done' => false);
echo formatJSON($json);
die;
}
} else {
if ($action == 'sendsms') {
$mobile = $_GET['m'];
$card_user_id = abs(intval($_SESSION['apply_card_real_u']));
$card = DB::GetTableRow('mcard', array('user_id' => $card_user_id));
$code = mt_rand(1000, 9999);
DB::Update('mcard', $card['id'], array('code' => $code));
sms_mcard_secret($mobile, $code);
}
}
示例13: upload_image
$update['small_image'] = upload_image('small_image',$activity['small_image'],'activity');
$update['begin_time'] = strtotime($update['begin_time']);
$update['end_time'] = strtotime($update['end_time']);
$update['result_time'] = strtotime($update['result_time']);
$insert_id = DB::Update("activity",$activity_id,$update);
Session::Set('notice', '编辑活动成功!');
redirect( WEB_ROOT . "/manage/activity/index.php");
}
// 所有商户
$partners = DB::LimitQuery('partner', array(
'condition'=>array('fid'=>0),
示例14: require_once
<?php
/**
* 编辑商圈功能
* @author abei <abei1982@qq.com>
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');
require_once(dirname(__FILE__) . '/current.php');
need_manager();
$id = abs(intval($_GET['id']));
$team = $eteam = Table::Fetch('team', $id);
if($_POST){
$insert = $_POST['insert'];
$result = DB::Update('team',$id,$insert);
Session::Set('notice', '更新商圈成功');
redirect( WEB_ROOT . "/manage/team/index.php");
}
$condition = array();
$condition['zone'] = 'bizarea';
$condition['fid'] = 0;
$areaList = DB::LimitQuery('category',array(
'condition'=>$condition
));
if($team['area_id'] > 0){
$cond = array();
$cond['zone'] = 'bizarea';
示例15: dirname
<?php
/**
* 导入商家
*
*/
die;
require_once dirname(dirname(__FILE__)) . '/app.php';
$file = file("data/card.csv");
foreach ($file as $row) {
$arr = explode(',', $row);
$id = $arr[0];
$arr = array('mcard_bizer_no' => '000' . $arr[1]);
DB::Update('store', $id, $arr);
}
echo "done";