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


PHP db_affected_rows函数代码示例

本文整理汇总了PHP中db_affected_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP db_affected_rows函数的具体用法?PHP db_affected_rows怎么用?PHP db_affected_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: remarchive

 function remarchive()
 {
     $ids = explode(",", db_escape_string($_REQUEST["ids"]));
     foreach ($ids as $id) {
         $result = db_query($this->link, "DELETE FROM ttrss_archived_feeds WHERE\n\t\t(SELECT COUNT(*) FROM ttrss_user_entries\n\t\t\t\t\t\t\tWHERE orig_feed_id = '{$id}') = 0 AND\n\t\tid = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
         $rc = db_affected_rows($this->link, $result);
     }
 }
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:8,代码来源:rpc.php

示例2: create

 function create($staffId, $ticketId, $created)
 {
     if (is_numeric($staffId) && is_numeric($ticketId)) {
         $sql = 'INSERT INTO ' . SPENT_TIME_TABLE . ' SET ticket_id=' . db_input($ticketId) . ', staff_id=' . db_input($staffId) . ', created=' . db_input($created) . ', ended=NOW()' . ', seconds=TIME_TO_SEC(TIMEDIFF(ended,created))';
         return db_query($sql) && db_affected_rows() == 1;
     }
     return false;
 }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:8,代码来源:class.spent_time.php

示例3: my_update_sql

/**
 * Perform an SQL query and return success or failure.
 *
 * @see http://api.drupal.org/api/function/update_sql/6
 *
 * @param $sql
 *   A string containing a complete SQL query.
 * @return
 *   An array containing the keys:
 *      success: a boolean indicating whether the query succeeded
 *      query: the SQL query executed, passed through check_plain()
 *      rows: number of rows effected
 */
function my_update_sql($sql)
{
    $args = func_get_args();
    array_shift($args);
    $result = db_query($sql, $args);
    $sql = my_return_query_string($sql, $args);
    return array('success' => $result !== FALSE, 'query' => check_plain($sql), 'rows' => db_affected_rows());
}
开发者ID:CIGIHub,项目名称:bsia-drupal8,代码行数:21,代码来源:apply_language_to_all_nodes.php

示例4: delete

 public function delete()
 {
     $sql = 'DELETE FROM ' . EQUIPMENT_TICKET_RECURRING__TABLE . ' WHERE id=' . db_input($this->id) . ' LIMIT 1';
     if (db_query($sql) && ($num = db_affected_rows())) {
         return $num;
     }
     $this->errors[] = 'Error deleting item!';
     return false;
 }
开发者ID:proktovief,项目名称:OSTEquipmentPlugin,代码行数:9,代码来源:class.ticket_recurring.php

示例5: hook_project_maintainer_save

/**
 * Invoked whenever a project maintainer is added or updated.
 *
 * This gives any modules that are providing their own per-project permissions
 * a chance to store the data about a maintainer's permissions whenever the
 * record for that maintainer is being saved.
 *
 * @param $nid
 *   The Project NID to save the maintainer information for.
 * @param $uid
 *   The user ID of the maintainer to save.
 * @param array $permissions
 *   Associative array of which project-level permissions the maintainer
 *   should have. The keys are permission names, and the values are if the
 *   permission should be granted or not.
 *
 * @see hook_project_permission_info()
 */
function hook_project_maintainer_save($nid, $uid, $permissions)
{
    // Try to update an existing record for this maintainer for our permission.
    db_query("UPDATE {example_project_maintainer} SET some_project_permission = %d WHERE nid = %d AND uid = %d", !empty($permissions['some project permission']), $nid, $uid);
    if (!db_affected_rows()) {
        // If we didn't have a record to update, add this as a new maintainer.
        db_query("INSERT INTO {example_project_maintainer} (nid, uid, some_project_permission) VALUES (%d, %d, %d)", $nid, $uid, !empty($permissions['some project permission']));
    }
}
开发者ID:Br3nda,项目名称:drupal-module-project,代码行数:27,代码来源:project.api.php

示例6: delete

 function delete()
 {
     db_query("delete from " . tbl_prefix . "weblog_comments where ident = '{$this->ident}'");
     if (db_affected_rows() > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:9,代码来源:class_comment.php

示例7: site_hminfo_delete

function site_hminfo_delete($id)
{
    $query = "DELETE FROM site_hminfo WHERE id = '" . $id . "'";
    $delete = db_query($query);
    if ($delete && db_affected_rows() > 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:horrabin,项目名称:opendb,代码行数:10,代码来源:hminfo.install.class.php

示例8: uc_stock_add_to_cart

/**
 * override hook_add_to_cart
 * 
 * @param string $nid
 * @param integer $qty
 * @param array $data
 * @return array
 */
function uc_stock_add_to_cart($nid, $qty, $data)
{
    $product = node_load($nid);
    uc_product_load($product);
    $sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND  stock <= 0";
    $result = db_fetch_object(db_query($sql, $product->model, $nid));
    if (db_affected_rows($result) == 1) {
        return array(array('success' => FALSE, 'message' => t('@product out of stock', array('@product' => $product->title))));
    }
}
开发者ID:householdsteve,项目名称:lotus-drupal,代码行数:18,代码来源:uc_modules_add_to_cart.php

示例9: renew

 function renew()
 {
     global $cfg;
     $sql = 'UPDATE ' . TICKET_LOCK_TABLE . ' SET expire=DATE_ADD(NOW(),INTERVAL ' . $cfg->getLockTime() . ' MINUTE) ' . ' WHERE lock_id=' . db_input($this->getId());
     //echo $sql;
     if (db_query($sql) && db_affected_rows()) {
         $this->reload();
         return true;
     }
     return false;
 }
开发者ID:googlecode-mirror,项目名称:barbos,代码行数:11,代码来源:class.lock.php

示例10: db_api_update_token

function db_api_update_token($c_member_id)
{
    $token = create_hash();
    $data = array('token' => $token);
    $where = array('c_member_id' => intval($c_member_id));
    db_update('c_api_member', $data, $where);
    if (!db_affected_rows()) {
        db_api_insert_token($c_member_id, $token);
    }
    return $token;
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:11,代码来源:api.php

示例11: delete

 /**
  * Deletes object from the database.
  * @return boolean True if object was deleted successfully, false otherwise.
  */
 public function delete()
 {
     $table = static::getTableName();
     $id_column = static::getIdColumn();
     $sql = 'DELETE FROM ' . $table . ' WHERE ' . $id_column . '=' . db_input($this->getId()) . ' LIMIT 1';
     if (db_query($sql) && ($num = db_affected_rows())) {
         return $num;
     }
     $this->addError('Error deleting item!');
     return false;
 }
开发者ID:proktovief,项目名称:OSTEquipmentPlugin,代码行数:15,代码来源:Entity.php

示例12: delete_announcement

function delete_announcement($announcement_id)
{
    $query = "DELETE FROM announcement WHERE sequence_number = " . $announcement_id;
    $delete = db_query($query);
    if (db_affected_rows() > 0) {
        opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, NULL, array($announcement_id));
        return TRUE;
    } else {
        opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, db_error(), array($announcement_id));
        return FALSE;
    }
}
开发者ID:horrabin,项目名称:opendb,代码行数:12,代码来源:functions.php

示例13: set

 function set($key, $value, $expire = CACHE_PERMANENT, $headers = NULL)
 {
     unset($this->content[$key]);
     $serialized = 0;
     if (!is_string($value)) {
         $value = serialize($value);
         $serialized = 1;
     }
     $created = time();
     db_query("UPDATE {" . $this->name . "} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $value, $created, $expire, $headers, $serialized, $key);
     if (!db_affected_rows()) {
         @db_query("INSERT INTO {" . $this->name . "} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $key, $value, $created, $expire, $headers, $serialized);
     }
 }
开发者ID:kimpepper,项目名称:drupal-base,代码行数:14,代码来源:db.php

示例14: saveuser

function saveuser()
{
    global $session, $dbqueriesthishit, $baseaccount, $companions, $chatloc;
    if (defined("NO_SAVE_USER")) {
        return false;
    }
    if ($session['loggedin'] && $session['user']['acctid'] != "") {
        // Any time we go to save a user, make SURE that any tempstat changes
        // are undone.
        restore_buff_fields();
        if (!$chatloc) {
            $session['user']['chatloc'] = 0;
        }
        $session['user']['allowednavs'] = serialize($session['allowednavs']);
        $session['user']['bufflist'] = serialize($session['bufflist']);
        if (isset($companions) && is_array($companions)) {
            $session['user']['companions'] = serialize($companions);
        }
        $sql = "";
        reset($session['user']);
        while (list($key, $val) = each($session['user'])) {
            if (is_array($val)) {
                $val = serialize($val);
            }
            //only update columns that have changed.
            if ($baseaccount[$key] != $val) {
                $sql .= "{$key}='" . addslashes($val) . "', ";
            }
        }
        //due to the change in the accounts table -> moved output -> save everyhit
        $sql .= "laston='" . date("Y-m-d H:i:s") . "', ";
        $sql = substr($sql, 0, strlen($sql) - 2);
        $sql = "UPDATE " . db_prefix("accounts") . " SET " . $sql . " WHERE acctid = " . $session['user']['acctid'];
        db_query($sql);
        if (isset($session['output']) && $session['output']) {
            $sql_output = "UPDATE " . db_prefix("accounts_output") . " SET output='" . addslashes($session['output']) . "' WHERE acctid={$session['user']['acctid']};";
            $result = db_query($sql_output);
            if (db_affected_rows($result) < 1) {
                $sql_output = "REPLACE INTO " . db_prefix("accounts_output") . " VALUES ({$session['user']['acctid']},'" . addslashes($session['output']) . "');";
                db_query($sql_output);
            }
        }
        unset($session['bufflist']);
        $session['user'] = array("acctid" => $session['user']['acctid'], "login" => $session['user']['login']);
        write_module_prefs();
        write_item_prefs();
        //$_SESSION['session'] = $session;
        //session_write_close();
    }
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:50,代码来源:saveuser.php

示例15: sys_maintenance

function sys_maintenance()
{
    global $config;
    $bashing_time_limit = SN_TIME_NOW - $config->fleet_bashing_scope;
    // TODO: Move here some cleaning procedures from admin/maintenance.php
    // TODO: Add description of operation to log it
    $queries = array(array('query' => "DELETE FROM {{bashing}} WHERE bashing_time < {$bashing_time_limit};", 'result' => false, 'error' => '', 'affected_rows' => 0), array('query' => 'DELETE FROM {{aks}} WHERE `id` NOT IN (SELECT DISTINCT `fleet_group` FROM {{fleets}});', 'result' => false, 'error' => '', 'affected_rows' => 0));
    foreach ($queries as &$query) {
        $query['result'] = doquery($query['query']);
        $query['error'] = db_error();
        $query['affected_rows'] = db_affected_rows();
    }
    return $queries;
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:14,代码来源:sys_maintenance.php


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