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


PHP db::update方法代码示例

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


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

示例1: saveMail

 function saveMail()
 {
     db::table('mails');
     db::where('mail_id', admin::get('id'));
     db::update(array('mail_name' => params::get('mail_name'), 'mail_subject' => params::get('mail_subject'), 'mail_content' => params::get('mail_content')));
     headers::self();
 }
开发者ID:rigidus,项目名称:ea,代码行数:7,代码来源:main.module.php

示例2: save

 function save()
 {
     $array = array('news_title' => params::get('news_title'), 'news_content' => params::get('news_content'), 'news_desc' => params::get('news_desc'));
     db::table('news');
     db::where('news_id', params::get('news_id'));
     db::update($array);
     headers::self();
 }
开发者ID:rigidus,项目名称:ea,代码行数:8,代码来源:main.module.php

示例3: newPassword

 function newPassword($new_pass)
 {
     if (!empty($new_pass)) {
         db::table('admin_users');
         db::where('user_id', ADMIN_USER_ID);
         db::update('user_password', md5($new_pass));
     }
 }
开发者ID:rigidus,项目名称:ea,代码行数:8,代码来源:profile.module.php

示例4: update

 function update($name, $value, $user_id = false)
 {
     if (!$user_id) {
         $user_id = ADMIN_USER_ID;
     }
     db::table('admin_users');
     db::where('user_id', $user_id);
     db::update($name, $value);
 }
开发者ID:rigidus,项目名称:ea,代码行数:9,代码来源:adminUser.php

示例5: update_password

function update_password($password)
{
    $db = new db();
    $user = get_user_data();
    $id = $user['id'];
    $password = md5($password);
    $result = $db->update("users", array("password" => $password), "id = :id", array(":id" => $id));
    return $result;
}
开发者ID:thuraucsy,项目名称:holiday,代码行数:9,代码来源:user.php

示例6: saveNewLearningTime

 public function saveNewLearningTime($values)
 {
     $this->_prepareLearningTimes();
     if (isset($values['id'])) {
         $id = $values['id'];
         unset($values['id']);
         db::update(':table:', $values)->where('id = %i', $id)->execute();
     } else {
         $sql = 'INSERT INTO [:table:]';
         $result = db::query($sql, $values);
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:12,代码来源:SchoolModel.php

示例7: recursiveLevelUpdate

 private function recursiveLevelUpdate($parent_id, $level)
 {
     static $counter = 0;
     $counter++;
     $items = db::select('*')->from(':table:')->where('parent = %i', $parent_id)->fetchAll();
     foreach ($items as $key => $item) {
         $update = $level + $counter;
         $values = array('level' => $update);
         db::update(':table:', $values)->where('id = %i', $item->id)->execute();
         $items[$key]['items'] = $this->recursiveLevelUpdate($item->id, $level);
     }
     return $items;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:13,代码来源:AdminMenuItemsModel.php

示例8: save_note

function save_note($id, $title, $body)
{
    if ($body == "" && $title == "") {
        $title = "Empty note";
    }
    if (($title == "" || $title == "Empty note") && $body != "") {
        $title = truncate(strip_tags($body), 30);
    }
    $db = new db();
    $result = $db->update("notes", array("title" => $title, "body" => $body), "id = :id", array(":id" => $id));
    $result = array("id" => $id, "title" => $title, "body" => $body);
    return $result;
}
开发者ID:thuraucsy,项目名称:holiday,代码行数:13,代码来源:note.php

示例9: update

 public function update()
 {
     error_log(__METHOD__);
     if (count($_POST)) {
         unset($this->in['id'], $this->in['created']);
         $this->in['updated'] = date('Y-m-d H:i:s');
         db::update($this->in, [['id', '=', $this->g->in['i']]]);
         header("Location: ?o=" . $this->o);
         exit;
     } elseif ($this->g->in['i']) {
         return $this->t->{$this->o . '_form'}(array_merge(db::read('*', 'id', $this->g->in['i'], '', 'one'), ['submit' => $this->update]));
     } else {
         return 'Error with Update';
     }
 }
开发者ID:netserva,项目名称:www,代码行数:15,代码来源:crud.php

示例10: save

 public function save($values)
 {
     $this->_prepare();
     $values['email'] = String::lower($values['name'] . '.' . $values['surname'] . '@st.fm.uniba.sk');
     if (!isset($values['id'])) {
         $values['password'] = String::lower($values['name'] . $values['surname']);
     }
     if (isset($values['id'])) {
         $id = $values['id'];
         unset($values['id']);
         db::update(':table:', $values)->where('id = %i', $id)->execute();
     } else {
         $sql = 'INSERT INTO [:table:]';
         $result = db::query($sql, $values);
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:16,代码来源:StudentsModel.php

示例11: restore

 function restore()
 {
     db::table('admin_log_trash');
     db::where('log_id', params::get('log_id'));
     $date = date('Y-m-d H:i:s');
     db::update('log_restored', $date);
     db::table('admin_log_trash');
     db::where('log_id', params::get('log_id'));
     $row = db::assoc();
     if ($row['log_tmpl'] == '1') {
         trash::restore(params::get('log_id'), SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/');
     } else {
         trash::restore(params::get('log_id'));
     }
     buffer::set(dt::date2print('%H:%i:%s<br />%d %F %y', $date));
 }
开发者ID:rigidus,项目名称:ea,代码行数:16,代码来源:trash.module.php

示例12: write

 public function write($id, $data)
 {
     $data = array('session_id' => $id, 'last_activity' => time(), 'data' => base64_encode($data));
     if ($this->session_id === NULL) {
         // Insert a new session
         $query = db::insert($this->table, $data)->execute($this->db);
     } elseif ($id === $this->session_id) {
         // Do not update the session_id
         unset($data['session_id']);
         // Update the existing session
         $query = db::update($this->table)->set($data)->where('session_id', '=', $id)->execute($this->db);
     } else {
         // Update the session and id
         $query = db::update($this->table)->set($data)->where('session_id', '=', $this->session_id)->execute($this->db);
         // Set the new session id
         $this->session_id = $id;
     }
     return (bool) $query->count();
 }
开发者ID:atlas1308,项目名称:testtesttestfarm,代码行数:19,代码来源:database.php

示例13: db

<?php

include "../../../../include/classes/main/db.class.php";
$op = $_POST['operation'];
$db = new db();
if ($op == "edit") {
    $id = $_POST['id'];
    $title = $_POST['title'];
    $text = $_POST['text'];
    if ($db->update("content", "title='" . $title . "', content='" . $text . "'", " id = '" . $id . "'")) {
        echo '0';
    } else {
        echo '1';
    }
} elseif ($op == "add") {
    $title = $_POST['title'];
    $text = $_POST['text'];
    $col[] = "title";
    $col[] = "content";
    $var[] = $title;
    $var[] = $text;
    //db::setDebug(2);
    if ($db->insert("content", $col, $var)) {
        if ($db->insert("navigation_links", array("link", "type", "content_id", "titel", "tpl"), array("content", "1", $db->getLastId(), $title, "1"))) {
            echo '0';
        }
    } else {
        echo '1';
    }
} elseif ($op == "delete") {
    $id = $_POST['id'];
开发者ID:Zorox3,项目名称:StarShadow,代码行数:31,代码来源:dbOperations.php

示例14: upgrade


//.........这里部分代码省略.........
     if ($version == 18) {
         $blocks = block_manager::get_active("site.sidebar");
         block_manager::set_active("site_sidebar", $blocks);
         module::clear_var("gallery", "blocks_site.sidebar");
         module::set_version("gallery", $version = 19);
     }
     // Set a default for the number of simultaneous uploads
     // Version 20 was reverted in 57adefc5baa7a2b0dfcd3e736e80c2fa86d3bfa2, so skip it.
     if ($version == 19 || $version == 20) {
         module::set_var("gallery", "simultaneous_upload_limit", 5);
         module::set_version("gallery", $version = 21);
     }
     // Update the graphics rules table so that the maximum height for resizes is 640 not 480.
     // Fixes ticket #671
     if ($version == 21) {
         $resize_rule = ORM::factory("graphics_rule")->where("id", "=", "2")->find();
         // make sure it hasn't been changed already
         $args = unserialize($resize_rule->args);
         if ($args["height"] == 480 && $args["width"] == 640) {
             $args["height"] = 640;
             $resize_rule->args = serialize($args);
             $resize_rule->save();
         }
         module::set_version("gallery", $version = 22);
     }
     // Update slug values to be legal.  We should have done this in the 11->12 upgrader, but I was
     // lazy.  Mea culpa!
     if ($version == 22) {
         foreach (db::build()->from("items")->select("id", "slug")->where(db::expr("`slug` REGEXP '[^_A-Za-z0-9-]'"), "=", 1)->execute() as $row) {
             $new_slug = item::convert_filename_to_slug($row->slug);
             if (empty($new_slug)) {
                 $new_slug = random::int();
             }
             db::build()->update("items")->set("slug", $new_slug)->set("relative_url_cache", null)->where("id", "=", $row->id)->execute();
         }
         module::set_version("gallery", $version = 23);
     }
     if ($version == 23) {
         $db->query("CREATE TABLE {failed_logins} (\n                  `id` int(9) NOT NULL auto_increment,\n                  `count` int(9) NOT NULL,\n                  `name` varchar(255) NOT NULL,\n                  `time` int(9) NOT NULL,\n                  PRIMARY KEY (`id`))\n                  DEFAULT CHARSET=utf8;");
         module::set_version("gallery", $version = 24);
     }
     if ($version == 24) {
         foreach (array("logs", "tmp", "uploads") as $dir) {
             self::_protect_directory(VARPATH . $dir);
         }
         module::set_version("gallery", $version = 25);
     }
     if ($version == 25) {
         db::build()->update("items")->set("title", db::expr("`name`"))->and_open()->where("title", "IS", null)->or_where("title", "=", "")->close()->execute();
         module::set_version("gallery", $version = 26);
     }
     if ($version == 26) {
         if (in_array("failed_logins", Database::instance()->list_tables())) {
             $db->query("RENAME TABLE {failed_logins} TO {failed_auths}");
         }
         module::set_version("gallery", $version = 27);
     }
     if ($version == 27) {
         // Set the admin area timeout to 90 minutes
         module::set_var("gallery", "admin_area_timeout", 90 * 60);
         module::set_version("gallery", $version = 28);
     }
     if ($version == 28) {
         module::set_var("gallery", "credits", "Powered by <a href=\"%url\">%gallery_version</a>");
         module::set_version("gallery", $version = 29);
     }
开发者ID:HarriLu,项目名称:gallery3,代码行数:67,代码来源:gallery_installer.php

示例15: array

while ($cursor != 0) {
    $connection->request('GET', $connection->url('1.1/friends/ids'), array('user_id' => $engagement_user_id, 'cursor' => $cursor));
    $http_code = $connection->response['code'];
    if ($http_code == 200) {
        $data = json_decode($connection->response['response'], true);
        // Get the list of friend user_ids, which will be an array
        $ids = $data['ids'];
        // Get the cursor value for the next request
        $cursor = $data['next_cursor_str'];
        // If there are any friends returned
        if (sizeof($ids)) {
            foreach ($ids as $user_id) {
                // If this friend is already in the table,
                // set the current field back to 1
                if ($db->in_table('friends', "user_id={$user_id}")) {
                    $db->update('friends', 'current=1', "user_id={$user_id}");
                } else {
                    // If this is a new friend,
                    // insert it with a current value of 1
                    $db->insert('friends', "user_id={$user_id},current=1");
                    // If this is not the first time friends have been collected,
                    // record this new friend event in the follow_log table
                    if (!$first_collection) {
                        $db->insert('follow_log', "user_id={$user_id},event='friend'");
                    }
                }
            }
        } else {
            // Stop collecting if no more friends are found
            break;
        }
开发者ID:rolencea,项目名称:org.civicrm.civisocial2,代码行数:31,代码来源:collect_engagement_friends.php


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