当前位置: 首页>>代码示例>>PHP>>正文


PHP Db::update方法代码示例

本文整理汇总了PHP中Db::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::update方法的具体用法?PHP Db::update怎么用?PHP Db::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Db的用法示例。


在下文中一共展示了Db::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unpublish

 public static function unpublish($id)
 {
     $id = Typo::int($id);
     $ins = array('table' => 'posts', 'id' => $id, 'key' => array('status' => '0'));
     $post = Db::update($ins);
     return $post;
 }
开发者ID:vdanelia,项目名称:GeniXCMS,代码行数:7,代码来源:Posts.class.php

示例2: reset_keywords

 function reset_keywords($new_kws_str, $type = 'equal')
 {
     $ks = $this->keywords();
     $old_kws = array();
     foreach ($ks as $k) {
         $old_kws[] = $k->keyword;
     }
     $ps = explode(',', $new_kws_str);
     $kws = array();
     foreach ($ps as $p) {
         $p = trim($p);
         if (strlen($p)) {
             $kws[$p] = $p;
         }
     }
     $to_del = array_diff($old_kws, $kws);
     foreach ($to_del as $k) {
         Db::escape($k);
         $sql = "delete from wx_reply_keywords where item_id='{$this->id}' and keyword='{$k}'";
         Db::query($sql);
     }
     $to_add = array_diff($kws, $old_kws);
     foreach ($to_add as $k) {
         WxReplyKeyword::save(array('type' => $type, 'keyword' => $k, 'item_id' => $this->id));
     }
     $sql = "update " . WxReplyKeyword::table() . " set type='{$type}' where item_id='{$this->id}'";
     Db::update($sql);
 }
开发者ID:zxw5775,项目名称:yuhunclub,代码行数:28,代码来源:WxReplyItem.php

示例3: update

 public static function update()
 {
     $post = Input::post(array('sitename', 'description', 'theme', 'twitter', 'home_page', 'posts_page'));
     $errors = array();
     if (empty($post['sitename'])) {
         $errors[] = 'You need a site sitename';
     }
     if (empty($post['description'])) {
         $errors[] = 'You need a site description';
     }
     if (empty($post['theme'])) {
         $errors[] = 'You need a theme';
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $post['sitename'] = htmlentities($post['sitename']);
     $post['description'] = htmlentities($post['description']);
     foreach ($post as $key => $value) {
         Db::update('meta', array('value' => $value), array('key' => $key));
     }
     Notifications::set('success', 'Your metadata has been updated');
     return true;
 }
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:25,代码来源:metadata.php

示例4: put

 /**
  * @return integer
  */
 public function put()
 {
     if (null === $this->identifier) {
         throw new Exception('Identifier not found.');
     }
     $fields = array();
     $update = $this->properties[$this->identifier]->has();
     $return = 0;
     foreach ($this->properties as $name => $instance) {
         if (!is_subclass_of($instance, 'Property')) {
             continue;
         }
         if ($instance instanceof PropertyIdentifier) {
             continue;
         }
         $fields[$name] = $instance->get();
     }
     if ($update) {
         $return = $affected = $this->db->update($this->table, $fields, array($this->identifier => $this->properties[$this->identifier]->get()));
     } else {
         $return = $inserted = $this->db->insert($this->table, $fields);
         if ($inserted) {
             $this->properties[$this->identifier]->set($inserted);
         }
     }
     $this->hash = Model::hash($this->properties);
     return $return;
 }
开发者ID:joksnet,项目名称:php-old,代码行数:31,代码来源:Model.php

示例5: updateSetting

 /**
  * 更新信息
  *
  * @param array $param 更新数据
  * @return bool 布尔类型的返回结果
  */
 public function updateSetting($param)
 {
     if (empty($param)) {
         return false;
     }
     /**
      * 因为是数值更新,所以需要循环数组
      */
     if (is_array($param)) {
         foreach ($param as $k => $v) {
             $tmp = array();
             $specialkeys_arr = array('statistics_code', 'qq_appcode', 'share_qqzone_appcode', 'share_sinaweibo_appcode');
             $tmp['value'] = in_array($k, $specialkeys_arr) ? htmlentities($v, ENT_QUOTES) : $v;
             $where = " name = '" . $k . "'";
             $result = Db::update('setting', $tmp, $where);
             if ($result !== true) {
                 return $result;
             }
         }
         @unlink(BasePath . DS . 'cache' . DS . 'setting.php');
         return true;
     } else {
         return false;
     }
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:31,代码来源:setting.model.php

示例6: update

 public static function update()
 {
     $post = Input::post(array('sitename', 'description', 'theme', 'twitter', 'home_page', 'posts_page', 'auto_published_comments', 'posts_per_page'));
     $errors = array();
     if (empty($post['sitename'])) {
         $errors[] = 'You need a site sitename';
     }
     if (empty($post['description'])) {
         $errors[] = 'You need a site description';
     }
     if (empty($post['theme'])) {
         $errors[] = 'You need a theme';
     }
     // auto publish comments
     $post['auto_published_comments'] = $post['auto_published_comments'] ? 1 : 0;
     // format posts per page, must be a whole number above 1 defaults to 10 if a invalid number is entered
     $post['posts_per_page'] = ($posts_per_page = intval($post['posts_per_page'])) > 0 ? $posts_per_page : 10;
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     foreach ($post as $key => $value) {
         Db::update('meta', array('value' => $value), array('key' => $key));
     }
     Notifications::set('success', 'Your metadata has been updated');
     return true;
 }
开发者ID:reqshark,项目名称:anchor-cms,代码行数:27,代码来源:metadata.php

示例7: updateCart

 /**
  * 更新购物车 
  *
  * @param	array	$param 商品信息
  */
 public function updateCart($param, $condition)
 {
     $array = array();
     //得到条件语句
     $condition_str = $this->getCondition($condition);
     $result = Db::update('cart', $param, $condition_str);
     return $result;
 }
开发者ID:noikiy,项目名称:ecmall,代码行数:13,代码来源:cart.model.php

示例8: update

    public function update()
    {
        if (empty($this->id)) {
            throw new Exception('Update error - Undefined photo id');
        }
        return Db::update('UPDATE photo SET quarter_id = :quarter_id, src = :src, info_id = :info_id, user_id = :user_id
		 	 WHERE id = :id', array('quarter_id' => $this->quarter_id, 'src' => $this->src, 'info_id' => $this->info_id, 'user_id' => $this->user_id, 'id' => (int) $this->id));
    }
开发者ID:vincenthib,项目名称:visiteztokyo,代码行数:8,代码来源:Photo.class.php

示例9: updatestat

 /**
  * 更新统计表
  *
  * @param	array $param	条件数组
  */
 public function updatestat($param)
 {
     if (empty($param)) {
         return false;
     }
     $result = Db::update($param['table'], array($param['field'] => array('sign' => 'increase', 'value' => $param['value'])), $param['where']);
     return $result;
 }
开发者ID:noikiy,项目名称:ecmall,代码行数:13,代码来源:statistics.model.php

示例10: tracelogEdit

	/**
	 * 更新动态记录
	 * @param	array $param 修改信息数组
	 * @param	array $condition 条件数组
	 */
	public function tracelogEdit($param,$condition){
		if(empty($param)) {
			return false;
		}
		//得到条件语句
		$condition_str	= $this->getCondition($condition);
		$result	= Db::update('sns_tracelog',$param,$condition_str);
		return $result;
	}
开发者ID:noikiy,项目名称:ejia,代码行数:14,代码来源:sns_tracelog.model.php

示例11: save

 public function save()
 {
     $params = json_encode($this->settings);
     $updateQuery = 'UPDATE jos_extensions SET params = ? WHERE `type`=\'component\' AND `element` = \'com_hubgraph\'';
     $insertQuery = 'INSERT INTO jos_extensions(name, `type`, `element`, params) VALUES (\'HubGraph\', \'component\', \'com_hubgraph\', ?)';
     if (!Db::update($updateQuery, array($params))) {
         Db::execute($insertQuery, array($params));
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:9,代码来源:client.php

示例12: editSharestore

	/**
	 * 更新分享店铺信息
	 * @param $param 更新内容
	 * @param $condition 更新条件
	 */
	public function editSharestore($param,$condition) {
		if(empty($param)) {
			return false;
		}
		//得到条件语句
		$condition_str	= $this->getCondition($condition);
		$result	= Db::update('sns_sharestore',$param,$condition_str);
		return $result;
	}
开发者ID:noikiy,项目名称:ejia,代码行数:14,代码来源:sns_sharestore.model.php

示例13: updateZtcOne

 /**
  * 直通车申请信息修改
  *
  * @param	array $param 修改信息数组
  * @param	int $ztc_id 团购商品id
  */
 public function updateZtcOne($param, $condition)
 {
     if (empty($param)) {
         return false;
     }
     //得到条件语句
     $condition_str = $this->getCondition($condition);
     $result = Db::update('ztc_goods', $param, $condition_str);
     return $result;
 }
开发者ID:noikiy,项目名称:ecmall,代码行数:16,代码来源:ztc.model.php

示例14: update

 public function update()
 {
     $values = $this->values;
     if (!isset($values['id'])) {
         return false;
     }
     $id = $values['id'];
     unset($values['id']);
     return Db::update($this->table, $values, array($this->index => $id));
 }
开发者ID:joksnet,项目名称:php-old,代码行数:10,代码来源:Model.php

示例15: editGoodsEval

 /**
  * 更新商品评分信息
  */
 public function editGoodsEval($param, $condition)
 {
     if (empty($param)) {
         return false;
     }
     //得到条件语句
     $condition_str = $this->getGoodsEvalCondition($condition);
     $result = Db::update('evaluate_goods', $param, $condition_str);
     return $result;
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:13,代码来源:evaluate.model.php


注:本文中的Db::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。