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


PHP DB::update方法代码示例

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


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

示例1: update

 /**
  * Memperbarui record tertentu.
  *
  * @return boolean
  */
 public function update($id, $data = [])
 {
     try {
         $this->db->update($this->table, $id, $data);
         return true;
     } catch (Exception $e) {
         die($e->getMessage);
     }
 }
开发者ID:eezhal92,项目名称:simple-mvc,代码行数:14,代码来源:Model.php

示例2: update

 public function update($tableid, $val, $data)
 {
     if (!$data) {
         return;
     }
     return DB::update($this->_get_table($tableid), $data, DB::field($this->_pk, $val));
 }
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:7,代码来源:table_forum_attachment_n.php

示例3: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('posts', function (Blueprint $table) {
         $table->renameColumn('pgp_fp', 'user_fp');
         $table->index('user_fp');
     });
     Schema::table('users', function (Blueprint $table) {
         $table->renameColumn('pgp_fp', 'user_fp');
         $table->index('user_fp');
     });
     Schema::table('bumps', function (Blueprint $table) {
         $table->string('user_fp', 40)->default('');
         $table->index('user_fp');
     });
     Schema::table('subs', function (Blueprint $table) {
         $table->string('user_fp', 40)->default('');
         $table->string('sub_fp', 40)->default('');
         $table->index('user_fp');
     });
     Schema::table('messages', function (Blueprint $table) {
         $table->string('user_fp', 40)->default('');
         $table->index('user_fp');
     });
     Schema::table('apikeys', function (Blueprint $table) {
         $table->string('user_fp', 40)->default('');
     });
     $queries = ['update posts left join users on posts.user_id = users.id set posts.user_fp = users.user_fp', 'update bumps left join users on bumps.user_id = users.id set bumps.user_fp = users.user_fp', 'update subs left join users on subs.user_id = users.id set subs.user_fp = users.user_fp', 'update subs left join users on subs.subscription_to = users.id set subs.sub_fp = users.user_fp', 'update messages left join users on messages.user_id = users.id set messages.user_fp = users.user_fp', 'update apikeys left join users on apikeys.user_id = users.id set apikeys.user_fp = users.user_fp'];
     foreach ($queries as $q) {
         DB::update($q);
     }
 }
开发者ID:libre-net-society,项目名称:onelon,代码行数:36,代码来源:2015_11_11_113219_add_user_fp.php

示例4: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->dateTime('announcement_expires')->nullable();
     });
     DB::update(DB::raw("UPDATE users SET announcement_expires = DATE_ADD(announcement_start, INTERVAL 7 DAY) WHERE announcement_start IS NOT NULL"));
 }
开发者ID:fencer-md,项目名称:stoticlle,代码行数:12,代码来源:2015_03_29_221328_user_announcements_expire.php

示例5: update_by_threadtableid

 public function update_by_threadtableid($threadtableid, $data, $unbuffered = false, $low_priority = false)
 {
     if (empty($data)) {
         return false;
     }
     return DB::update($this->_table, $data, DB::field('threadtableid', $threadtableid), $unbuffered, $low_priority);
 }
开发者ID:lemonstory,项目名称:bbs,代码行数:7,代码来源:table_forum_forum_threadtable.php

示例6: update_cpgroupid_by_cpgroupid

 public function update_cpgroupid_by_cpgroupid($val, $data)
 {
     if (!is_array($data)) {
         return null;
     }
     return DB::update('common_admincp_member', $data, DB::field('cpgroupid', $val));
 }
开发者ID:softhui,项目名称:discuz,代码行数:7,代码来源:table_common_admincp_member.php

示例7: action_delete

 public function action_delete()
 {
     $district = $this->get_orm_model('district', $this->_base_url);
     $services = $district->services->find_all();
     if ($_POST) {
         if (Arr::get($_POST, 'submit')) {
             $msg = __(Kohana::message('admin', 'district.delete_success'), array(':name' => $district->name));
             $query = DB::update('services')->set(array('district_id' => NULL))->where('district_id', '=', $district->id)->execute();
             $district->content->delete();
             $district->delete();
             if (count($services) > 0) {
                 $msg .= __(Kohana::message('admin', 'metro.delete_success_services'), array(':count' => count($services)));
             }
             Message::set(Message::SUCCESS, $msg);
         }
         $this->request->redirect($this->_base_url);
     }
     $text = __(Kohana::message('admin', 'district.delete_question'), array(':name' => $district->name));
     if (count($services) > 0) {
         $text .= __(Kohana::message('admin', 'metro.delete_question_services'), array(':count' => count($services)));
     }
     $this->template->title = 'Удаление округа "' . $district->name . '"';
     $this->template->bc['#'] = $this->template->title;
     $this->view = View::factory('backend/delete')->set('from_url', $this->_base_url)->set('title', $this->template->title)->set('text', $text);
     $this->template->content = $this->view;
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:26,代码来源:district.php

示例8: login

 function login()
 {
     $accessToken = Url::get('accessToken', '');
     $login_info = json_decode(file_get_contents('http://ids.cpvm.vn/services/api/users/check_open_user.php?o=' . $accessToken . '&t=2'));
     if ($login_info->s) {
         $token = $login_info->v->t;
         //Lay thong tin user theo token
         $info = json_decode(file_get_contents('http://ids.cpvm.vn/services/api/users/userinfo.php?t=' . $token));
         if ($info->s) {
             $u = $info->v->u;
             $user = User::getUserById($u->id);
             if (!$user) {
                 // user chua co trong db => clone
                 $data = array('id' => $u->id, 'user_name' => $u->un, 'full_name' => $u->fn, 'avatar_url' => $u->av);
                 $id = DB::insert('account', $data);
             } else {
                 DB::update('account', array('full_name' => $u->fn), 'id=' . $u->id);
             }
             $u->t = $token;
             //dang nhap
             User::LogIn2((array) $u);
             $_SESSION['token'] = $token;
             echo 1;
         } else {
             echo 0;
         }
     } else {
         echo 0;
     }
     exit;
 }
开发者ID:hqd276,项目名称:bigs,代码行数:31,代码来源:ajax_openid.ajax.php

示例9: update_by_find

 public function update_by_find($find, $data)
 {
     if (!empty($find) && !empty($data) && is_array($data)) {
         return DB::update($this->_table, $data, DB::field('find', $find));
     }
     return 0;
 }
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:7,代码来源:table_common_word.php

示例10: replace_orgid_by_uid

 public function replace_orgid_by_uid($uid, $orgarr)
 {
     $orgids = array();
     foreach ($orgarr as $key => $value) {
         $orgids[] = $key;
     }
     $Oorgids = self::fetch_orgids_by_uid($uid);
     if (!is_array($orgids)) {
         $orgids = array($orgids);
     }
     $insertids = array_diff($orgids, $Oorgids);
     $delids = array_diff($Oorgids, $orgids);
     $updateids = array_diff($orgids, $delids, $insertids);
     if ($delids) {
         DB::delete($this->_table, "uid='{$uid}' and orgid IN (" . dimplode($delids) . ")");
     }
     foreach ($insertids as $orgid) {
         if ($orgid > 0) {
             parent::insert(array("orgid" => $orgid, 'jobid' => $orgarr[$orgid], 'uid' => $uid, 'dateline' => TIMESTAMP), 0, 1);
         }
     }
     foreach ($updateids as $orgid) {
         if ($orgid > 0) {
             DB::update($this->_table, array('jobid' => $orgarr[$orgid]), "orgid='{$orgid}' and uid='{$uid}'");
         }
     }
     wx_updateUser($uid);
     return true;
 }
开发者ID:druphliu,项目名称:dzzoffice,代码行数:29,代码来源:table_organization_user.php

示例11: insert

 function insert($arr, $id)
 {
     global $_G;
     if (!$arr) {
         return false;
     }
     $arr['nick'] = $arr['nick'] ? trim($arr['nick']) : '';
     $arr['sid'] = $arr['sid'] ? trim($arr['sid']) : '';
     $arr['title'] = $arr['title'] ? trim($arr['title']) : '';
     $arr['desc'] = $arr['desc'] ? trim($arr['desc']) : '';
     $arr['pic_path'] = $arr['pic_path'] ? trim($arr['pic_path']) : '';
     $arr['picurl'] = $arr['picurl'] ? trim($arr['picurl']) : '';
     $arr['banner'] = $arr['banner'] ? trim($arr['banner']) : '';
     $arr['url'] = $arr['url'] ? trim($arr['url']) : '';
     $arr['start_time'] = dmktime($arr['start_time']);
     $arr['end_time'] = dmktime($arr['end_time']);
     $arr['zk'] = floatval($arr['zk']);
     $arr['cate'] = intval($arr['cate']);
     $arr['shop_type'] = intval($arr['shop_type']);
     $arr['hide'] = intval($arr['hide']);
     $arr['sort'] = intval($arr['sort']);
     if ($id > 0) {
         $id = DB::update('shop', $arr, 'id=' . $id);
         api_post(array('a' => 'update', 'table' => 'shop', 'data' => $arr, 'pre_key' => 'sid', 'id' => $arr['sid'], 'cache' => 'channels,all_channel'));
     } else {
         $arr['dateline'] = TIMESTAMP;
         $id = DB::insert('shop', $arr, 1);
         if ($id > 0) {
             api_post(array('a' => 'insert', 'table' => 'shop', 'data' => $arr, 'cache' => 'shop,shop_type', 'id' => $id));
         }
     }
     return $id;
 }
开发者ID:sayi21cn,项目名称:ttae_open,代码行数:33,代码来源:shop.api.php

示例12: save

 public function save($isNewUser = false)
 {
     //create a new database object.
     $db = new DB();
     $username = mysql_real_escape_string($this->username);
     $email = mysql_real_escape_string($this->email);
     $firstName = mysql_real_escape_string($this->firstName);
     $lastName = mysql_real_escape_string($this->lastName);
     $link = mysql_real_escape_string($this->link);
     $blog = mysql_real_escape_string($this->blog);
     //if the user is already registered and we're
     //just updating their info.
     if (!$isNewUser) {
         //set the data array
         $data = array("username" => "'{$username}'", "password" => "'{$this->hashedPassword}'", "email" => "'{$email}'", "firstName" => "'{$firstName}'", "lastName" => "'{$lastName}'", "link" => "'{$link}'", "blog" => "'{$blog}'");
         //update the row in the database
         $db->update($data, 'users', 'id = ' . $this->id);
     } else {
         //if the user is being registered for the first time.
         $data = array("username" => "'{$username}'", "password" => "'{$this->hashedPassword}'", "email" => "'{$email}'", "link" => "'{$link}'", "blog" => "'{$blog}'", "firstName" => "'{$firstName}'", "lastName" => "'{$lastName}'", "join_date" => "'" . date("Y-m-d H:i:s", time()) . "'");
         $this->id = $db->insert($data, 'users');
         $this->joinDate = time();
     }
     return true;
 }
开发者ID:OniGen1337,项目名称:Commentz,代码行数:25,代码来源:User.class.php

示例13: update_by_aid

 public function update_by_aid($aid, $data)
 {
     if (($aid = dintval($aid)) && !empty($data) && is_array($data)) {
         return DB::update($this->_table, $data, array('aid' => $aid));
     }
     return 0;
 }
开发者ID:dalinhuang,项目名称:healthshop,代码行数:7,代码来源:table_portal_article_content.php

示例14: update

 public function update($tid, $pid, $data)
 {
     if (empty($data) || !is_array($data)) {
         return false;
     }
     DB::update('forum_trade', $data, array('tid' => $tid, 'pid' => $pid));
 }
开发者ID:softhui,项目名称:discuz,代码行数:7,代码来源:table_forum_trade.php

示例15: deleteTopic

 /**
  * {@inheritDoc}
  */
 public function deleteTopic(EloquentTopic $topic)
 {
     // Clean and convert ids
     $ids = implode(',', array_filter($topic->pathExplode(), 'is_numeric'));
     $query = "UPDATE forums\n\t\t\t      SET posts = posts - ?, topics_count = topics_count - 1\n\t\t\t      WHERE id IN ({$ids})";
     return \DB::update($query, [$topic->posts_count]);
 }
开发者ID:kaamaru,项目名称:laravel-forums,代码行数:10,代码来源:EloquentForumRepo.php


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