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


PHP mysqli_affected_rows函数代码示例

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


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

示例1: Copyright

/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                			    |
|--------------------------------------------------------------------------|
|   Licence Info: GPL			                                    |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V5					    |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless, Autotron, whocares, Swizzles.					    |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== Delete inactive user accounts
    $secs = 350 * 86400;
    $dt = TIME_NOW - $secs;
    $maxclass = UC_STAFF;
    sql_query("SELECT FROM users WHERE parked='no' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
    //== Delete parked user accounts
    $secs = 675 * 86400;
    // change the time to fit your needs
    $dt = TIME_NOW - $secs;
    $maxclass = UC_STAFF;
    sql_query("SELECT FROM users WHERE parked='yes' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
    if ($queries > 0) {
        write_log("Inactive Clean -------------------- Inactive Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:43,代码来源:inactive_update.php

示例2: processQuery

 public function processQuery($sql, $type = NULL)
 {
     $result = mysqli_query($this->db, $sql);
     $this->checkForError();
     $data = array();
     if ($result instanceof mysqli_result) {
         $resultType = MYSQLI_NUM;
         if ($type == 'assoc') {
             $resultType = MYSQLI_ASSOC;
         }
         while ($row = mysqli_fetch_array($result, $resultType)) {
             if (mysqli_affected_rows($this->db) > 1) {
                 array_push($data, $row);
             } else {
                 $data = $row;
             }
         }
         mysqli_free_result($result);
     } else {
         if ($result) {
             $data = mysqli_insert_id($this->db);
         }
     }
     return $data;
 }
开发者ID:veggiematts,项目名称:usage,代码行数:25,代码来源:DBService.php

示例3: mysql_compat_affected_rows

function mysql_compat_affected_rows($link = NULL)
{
    if (!isset($link)) {
        $link = $GLOBALS['mysql_compat_last_link'];
    }
    return mysqli_affected_rows($link);
}
开发者ID:bAndie91,项目名称:mysql-compat-php,代码行数:7,代码来源:mysql_compat.php

示例4: affectedRow

 public function affectedRow()
 {
     if ($this->con) {
         return mysqli_affected_rows($this->con);
     }
     return 0;
 }
开发者ID:pvtamh2bg,项目名称:mn2015,代码行数:7,代码来源:Database.php

示例5: affectedRows

 /**
  * Return the number of rows affected by a query.
  *
  * @return integer
  */
 public static function affectedRows()
 {
     if (is_null(self::$conn_id)) {
         self::init();
     }
     return mysqli_affected_rows(self::$conn_id);
 }
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:12,代码来源:class.dbconnection.php

示例6: docleanup

function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    sql_query("UPDATE `freeslots` SET `addedup` = 0 WHERE `addedup` != 0 AND `addedup` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `freeslots` SET `addedfree` = 0 WHERE `addedfree` != 0 AND `addedfree` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("DELETE FROM `freeslots` WHERE `addedup` = 0 AND `addedfree` = 0") or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `free_switch` = 0 WHERE `free_switch` > 1 AND `free_switch` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `torrents` SET `free` = 0 WHERE `free` > 1 AND `free` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `downloadpos` = 1 WHERE `downloadpos` > 1 AND `downloadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `uploadpos` = 1 WHERE `uploadpos` > 1 AND `uploadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `chatpost` = 1 WHERE `chatpost` > 1 AND `chatpost` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `avatarpos` = 1 WHERE `avatarpos` > 1 AND `avatarpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `immunity` = 0 WHERE `immunity` > 1 AND `immunity` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `warned` = 0 WHERE `warned` > 1 AND `warned` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `pirate` = 0 WHERE `pirate` > 1 AND `pirate` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `king` = 0 WHERE `king` > 1 AND `king` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    if ($queries > 0) {
        write_log("User Clean -------------------- User Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
开发者ID:CharlieHD,项目名称:U-232-V3,代码行数:28,代码来源:user_update.php

示例7: insertItems

 public function insertItems(Items $items)
 {
     $con = self::openConnection();
     $affected = 0;
     mysqli_begin_transaction($con);
     $stm = mysqli_stmt_init($con);
     $sql = "INSERT INTO category VALUES (?, ?, ?)";
     mysqli_stmt_prepare($stm, $sql);
     foreach ($items->getItems() as $item) {
         $code = $item->getCode();
         $name = $item->getName();
         $parent = $item->getParent() == null ? null : $item->getParent()->getCode();
         mysqli_stmt_bind_param($stm, 'sss', $code, $name, $parent);
         mysqli_stmt_execute($stm);
         if (mysqli_affected_rows($con) == 1) {
             $affected++;
         }
     }
     if ($affected > 0) {
         mysqli_commit($con);
     } else {
         mysqli_rollback($con);
     }
     return $affected;
 }
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:25,代码来源:CategoryDAO.php

示例8: insertDepartment

function insertDepartment($name, $manager_id)
{
    checkConnectivity2();
    $query = sprintf("insert into department(name,manager_id\t) values('%s',%s)", $name, $manager_id);
    mysqli_query($GLOBALS['connection_link'], $query);
    return mysqli_affected_rows($GLOBALS['connection_link']) > 0;
}
开发者ID:mohamed-moanis,项目名称:qa,代码行数:7,代码来源:insetQuires.php

示例9: docleanup

function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    //== Delete old backup's
    $days = 3;
    $res = sql_query("SELECT id, name FROM dbbackup WHERE added < " . sqlesc(TIME_NOW - $days * 86400)) or sqlerr(__FILE__, __LINE__);
    if (mysqli_num_rows($res) > 0) {
        $ids = array();
        while ($arr = mysqli_fetch_assoc($res)) {
            $ids[] = (int) $arr['id'];
            $filename = $INSTALLER09['backup_dir'] . '/' . $arr['name'];
            if (is_file($filename)) {
                unlink($filename);
            }
        }
        sql_query('DELETE FROM dbbackup WHERE id IN (' . implode(', ', $ids) . ')') or sqlerr(__FILE__, __LINE__);
    }
    //== end
    if ($queries > 0) {
        write_log("Backup Clean -------------------- Backup Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:30,代码来源:backup_update.php

示例10: executeQuery

 /**
  * Native function for executing mysql query
  */
 private function executeQuery($q)
 {
     if (empty($q)) {
         throw new DBException('Empty query submitted!');
     }
     if (DB_DEBUG) {
         $start = microtime(true);
     }
     $this->_res_resource = mysqli_query($this->_con, $q);
     if (DB_DEBUG) {
         $end = microtime(true);
         $this->_executedQueries[] = array('q' => $q, 'time' => $end - $start);
     }
     if (!$this->_res_resource) {
         throw new DBException(mysqli_error($this->_con));
     }
     if (preg_match('/^SELECT.+/', strtoupper($q))) {
         $this->_res_num = @mysqli_num_rows($this->_res_resource);
     } elseif (preg_match('/^INSERT.+/', strtoupper($q))) {
         $this->_last_inserted_id = mysqli_insert_id($this->_con);
         $this->_affected_rows = @mysqli_affected_rows($this->_con);
     } else {
         $this->_affected_rows = @mysqli_affected_rows($this->_con);
     }
     return true;
 }
开发者ID:arschlochnop,项目名称:masscan-web-ui,代码行数:29,代码来源:class.mysql.php

示例11: ejecutar

 public function ejecutar($sql, $conexion)
 {
     $n = 0;
     $resultado = mysqli_query($conexion, $sql);
     $n = mysqli_affected_rows($conexion);
     return $n;
 }
开发者ID:einarenrique,项目名称:Reto-Masa-Corporal,代码行数:7,代码来源:fung33ker.php

示例12: insertItems

 public function insertItems(Items $items)
 {
     $con = self::openConnection();
     $affected = 0;
     mysqli_begin_transaction($con);
     $stm = mysqli_stmt_init($con);
     $sql = "INSERT INTO product VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
     mysqli_stmt_prepare($stm, $sql);
     foreach ($items->getItems() as $item) {
         $code = $item->getCode();
         $articul = $item->getArticul();
         $name = $item->getName();
         $bmuID = $item->getBasicMeasurementUnit() == null ? null : $item->getBasicMeasurementUnit()->getId();
         $price = $item->getPrice();
         $curID = $item->getCurrency() == null ? null : $item->getCurrency()->getId();
         $muID = $item->getMeasurementUnit() == null ? null : $item->getMeasurementUnit()->getId();
         $parent = $item->getParent() == null ? null : $item->getParent()->getCode();
         mysqli_stmt_bind_param($stm, 'sssdddds', $code, $articul, $name, $bmuID, $price, $curID, $muID, $parent);
         mysqli_stmt_execute($stm);
         if (mysqli_affected_rows($con) == 1) {
             $affected++;
         }
     }
     if ($affected > 0) {
         mysqli_commit($con);
     } else {
         mysqli_rollback($con);
     }
     return $affected;
 }
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:30,代码来源:ProductDAO.php

示例13: query

 public function query($sql)
 {
     $pos = stripos($sql, 'select');
     if (is_numeric($pos)) {
         //是select 语句
         $rs = mysqli_query($this->conn, $sql);
         if (mysqli_errno($this->conn)) {
             die('you have an error ' . mysqli_error($this->conn));
         }
         if ($rs === false) {
             return mysqli_affected_rows($this->conn);
         }
         //什么时候返回是false呢...哦子查询是select
         $columns = array();
         while ($property = @mysqli_fetch_field($rs)) {
             $columns[] = $property->name;
         }
         $arr = array();
         while ($result = @mysqli_fetch_row($rs)) {
             $arr[] = array_combine($columns, $result);
         }
         return $arr;
     } else {
         mysqli_query($this->conn, $sql);
         if (mysqli_errno($this->conn)) {
             die('you have an error ' . mysqli_error($this->conn));
         }
         return mysqli_affected_rows($this->conn);
     }
 }
开发者ID:Qbuer,项目名称:pt-wechat,代码行数:30,代码来源:conn.class.php

示例14: Copyright

/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                                |
|--------------------------------------------------------------------------|
|   Licence Info: GPL                                                |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V4                        |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless,putyn.                        |
|--------------------------------------------------------------------------|
_   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    $deadtime = TIME_NOW - $INSTALLER09['signup_timeout'];
    $res = sql_query("SELECT id, username, added, downloaded, uploaded, last_access, class, donor, warned, enabled, status FROM users WHERE status = 'pending' AND added < {$deadtime} AND last_login < {$deadtime} AND last_access < {$deadtime} ORDER BY username DESC");
    if (mysqli_num_rows($res) != 0) {
        while ($arr = mysqli_fetch_assoc($res)) {
            $userid = $arr['id'];
            $res_del = sql_query("DELETE FROM users WHERE id=" . sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
            $mc1->delete_value('MyUser_' . $userid);
            $mc1->delete_value('user' . $userid);
            write_log("User: {$arr['username']} Was deleted by Expired Signup clean");
        }
    }
    if ($queries > 0) {
        write_log("Expired Signup clean-------------------- Expired Signup cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:43,代码来源:expired_signup_update.php

示例15: scrape

function scrape($url, $infohash = '')
{
    global $TABLE_PREFIX, $BASEDIR;
    if (isset($url)) {
        $url_c = parse_url($url);
        if (!isset($url_c["port"]) || empty($url_c["port"])) {
            $url_c["port"] = 80;
        }
        require_once $BASEDIR . "/phpscraper/" . $url_c["scheme"] . "tscraper.php";
        try {
            $timeout = 5;
            if ($url_c["scheme"] == "udp") {
                $scraper = new udptscraper($timeout);
            } else {
                $scraper = new httptscraper($timeout);
            }
            $ret = $scraper->scrape($url_c["scheme"] . "://" . $url_c["host"] . ":" . $url_c["port"] . ($url_c["scheme"] == "udp" ? "" : "/announce"), array($infohash));
            do_sqlquery("UPDATE `{$TABLE_PREFIX}files` SET `lastupdate`=NOW(), `lastsuccess`=NOW(), `seeds`=" . $ret[$infohash]["seeders"] . ", `leechers`=" . $ret[$infohash]["leechers"] . ", `finished`=" . $ret[$infohash]["completed"] . " WHERE `announce_url` = '" . $url . "'" . ($infohash == "" ? "" : " AND `info_hash`='" . $infohash . "'"), true);
            if (mysqli_affected_rows($GLOBALS["___mysqli_ston"]) == 1) {
                write_log('SUCCESS update external torrent from ' . $url . ' tracker (infohash: ' . $infohash . ')', '');
            }
        } catch (ScraperException $e) {
            write_log("FAILED update external torrent " . ($infohash == "" ? "" : "(infohash: " . $infohash . ")") . " from " . $url . " tracker (" . $e->getMessage() . "))", "");
        }
        return;
    }
    return;
}
开发者ID:Karpec,项目名称:gizd,代码行数:28,代码来源:getscrape_single.php


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