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


PHP Db::queryRow方法代码示例

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


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

示例1: getWormholeSystemInfo

 /**
  * Fetches information for a wormhole system.
  *
  * @param int $systemID
  *
  * @return array
  */
 public static function getWormholeSystemInfo($systemID)
 {
     if ($systemID < 3100000) {
         return;
     }
     return Db::queryRow('select * from ccp_zwormhole_info where solarSystemID = :systemID', array(':systemID' => $systemID), 3600);
 }
开发者ID:Nord001,项目名称:zKillboard,代码行数:14,代码来源:Info.php

示例2: addKey

 /**
  * Adds a key to the database.
  *
  * @static
  * @param int $keyID
  * @param string $vCode
  * @param null|string $label
  * @return string
  */
 public static function addKey($keyID, $vCode, $label = null)
 {
     $userID = User::getUserID();
     if ($userID == null) {
         $userID = 0;
     }
     $exists = Db::queryRow("SELECT userID, keyID, vCode FROM zz_api WHERE keyID = :keyID AND vCode = :vCode", array(":keyID" => $keyID, ":vCode" => $vCode), 0);
     if ($exists == null) {
         // Insert the api key
         Db::execute("replace into zz_api (userID, keyID, vCode, label) VALUES (:userID, :keyID, :vCode, :label)", array(":userID" => $userID, ":keyID" => $keyID, ":vCode" => $vCode, ":label" => $label));
     } else {
         if ($exists["userID"] == 0) {
             // Someone already gave us this key anonymously, give it to this user
             Db::execute("UPDATE zz_api SET userID = :userID, label = :label WHERE keyID = :keyID", array(":userID" => $userID, ":label" => $label, ":keyID" => $keyID));
             return "keyID {$keyID} previously existed in our database but has now been assigned to you.";
         } else {
             return "keyID {$keyID} is already in the database...";
         }
     }
     $pheal = Util::getPheal($keyID, $vCode);
     $result = $pheal->accountScope->APIKeyInfo();
     $key = $result->key;
     $keyType = $key->type;
     if ($keyType == "Account") {
         $keyType = "Character";
     }
     $ip = IP::get();
     Log::log("API: {$keyID} has been added.  Type: {$keyType} ({$ip})");
     return "Success, your {$keyType} key has been added.";
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:39,代码来源:Api.php

示例3: calculatePoints

 public static function calculatePoints($killID, $tempTables = false)
 {
     $temp = $tempTables ? "_temporary" : "";
     $victim = Db::queryRow("select * from zz_participants{$temp} where killID = :killID and isVictim = 1", array(":killID" => $killID), 0);
     $kill = $victim;
     $involved = Db::query("select * from zz_participants{$temp} where killID = :killID and isVictim = 0", array(":killID" => $killID), 0);
     $vicpoints = self::getPoints($victim["groupID"]);
     $vicpoints += $kill["total_price"] / 10000000;
     $maxpoints = round($vicpoints * 1.2);
     $invpoints = 0;
     foreach ($involved as $inv) {
         $invpoints += self::getPoints($inv["groupID"]);
     }
     if ($vicpoints + $invpoints == 0) {
         return 0;
     }
     $gankfactor = $vicpoints / ($vicpoints + $invpoints);
     $points = ceil($vicpoints * ($gankfactor / 0.75));
     if ($points > $maxpoints) {
         $points = $maxpoints;
     }
     $points = round($points, 0);
     return max(1, $points);
     // a kill is always worth at least one point
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:25,代码来源:Points.php

示例4: beSocial

 public static function beSocial($killID)
 {
     if ($killID < 0) {
         return;
     }
     $ircMin = 5000000000;
     $twitMin = 10000000000;
     // This is an array of characters we like to laugh at :)
     $laugh = array(1633218082, 924610627, 619471207, 268946627, 179004085, 428663616);
     $count = Db::queryField("select count(*) count from zz_social where killID = :killID", "count", array(":killID" => $killID), 0);
     if ($count != 0) {
         return;
     }
     // Get victim info
     $victimInfo = Db::queryRow("select * from zz_participants where killID = :killID and isVictim = 1", array(":killID" => $killID));
     if ($victimInfo == null) {
         return;
     }
     $totalPrice = $victimInfo["total_price"];
     if (!in_array($victimInfo["characterID"], $laugh)) {
         // If in laugh array, skip the checks
         // Check the minimums, min. price and happened in last 12 hours
         if ($totalPrice < $ircMin) {
             return;
         }
     }
     Info::addInfo($victimInfo);
     $url = "https://zkillboard.com/detail/{$killID}/";
     if ($totalPrice >= $twitMin) {
         $url = Twit::shortenUrl($url);
     }
     $message = "|g|" . $victimInfo["shipName"] . "|n| worth |r|" . Util::formatIsk($totalPrice) . " ISK|n| was destroyed! {$url}";
     if (!isset($victimInfo["characterName"])) {
         $victimInfo["characterName"] = $victimInfo["corporationName"];
     }
     if (strlen($victimInfo["characterName"]) < 25) {
         $name = $victimInfo["characterName"];
         if (Util::endsWith($name, "s")) {
             $name .= "'";
         } else {
             $name .= "'s";
         }
         $message = "{$name} {$message}";
     }
     Db::execute("insert into zz_social (killID) values (:killID)", array(":killID" => $killID));
     Log::irc("{$message}");
     $message = Log::stripIRCColors($message);
     if ($totalPrice >= $twitMin) {
         $message .= " #tweetfleet #eveonline";
         $return = Twit::sendMessage($message);
         $twit = "https://twitter.com/eve_kill/status/" . $return->id;
         Log::irc("Message was also tweeted: |g|{$twit}");
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:54,代码来源:Social.php

示例5: execute

 public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     if (Util::isMaintenanceMode()) {
         irc_error("|r|Cannot reprice while in maintenance mode");
     }
     @($killID = (int) $parameters[0]);
     if ($killID == 0) {
         irc_error("|r|Please provide a valid killID.");
     }
     $count = Db::queryField("select count(*) count from zz_participants where killID = :killID", "count", array(":killID" => $killID));
     if ($count == 0) {
         irc_error("|r|KillID {$killID} does not exist!");
     }
     Stats::calcStats($killID, false);
     Db::execute("update zz_killmails set processed = 0 where killID = :killID", array(":killID" => $killID));
     do {
         sleep(1);
         $processed = Db::queryField("select processed from zz_killmails where killID = :killID", "processed", array(":killID" => $killID), 0);
     } while ($processed == 0);
     $kill = Db::queryRow("select * from zz_participants where isVictim = 1 and killID = :killID", array(":killID" => $killID), 0);
     $total = $kill["total_price"];
     $points = $kill["points"];
     irc_out("|g|{$killID}|n| repriced to|g| " . number_format($total, 2) . "|n| ISK and |g|" . number_format($points, 0) . "|n| points");
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:24,代码来源:irc_reprice.php

示例6: array

 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
$message = array();
$info = User::getUserInfo();
$ticket = Db::queryRow("SELECT * FROM zz_tickets WHERE id = :id", array(":id" => $id), 0);
if ($ticket == NULL or sizeof($ticket) == 0) {
    $message = array("status" => "error", "message" => "Ticket does not exist.");
} elseif ($ticket["status"] == 0) {
    $message = array("status" => "error", "message" => "Ticket has been closed, you cannot post, only view it");
} elseif ($ticket["userid"] != $info["id"] && $info["moderator"] == 0 && $info["admin"] == 0) {
    $app->notFound();
}
if ($_POST) {
    $reply = Util::getPost("reply");
    if ($reply && $ticket["status"] != 0) {
        $name = $info["username"];
        $moderator = $info["moderator"];
        $check = Db::query("SELECT * FROM zz_tickets_replies WHERE reply = :reply AND userid = :userid AND belongsTo = :id", array(":reply" => $reply, ":userid" => $info["id"], ":id" => $id), 0);
        if (!$check) {
            Db::execute("INSERT INTO zz_tickets_replies (userid, belongsTo, name, reply, moderator) VALUES (:userid, :belongsTo, :name, :reply, :moderator)", array(":userid" => $info["id"], ":belongsTo" => $id, ":name" => $name, ":reply" => $reply, ":moderator" => $moderator));
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:31,代码来源:tickets_view.php

示例7: loadFile

function loadFile($file, $table)
{
    if (Util::endsWith($file, ".gz")) {
        $handle = gzopen($file, "r");
    } else {
        $handle = fopen($file, "r");
    }
    if (Db::queryRow("SHOW TABLES LIKE'{$table}'") != null) {
        //Check to see if we are adding new tables
        if (Util::startsWith($table, "ccp_")) {
            Db::execute("drop table {$table}");
        } else {
            Db::execute("alter table {$table} rename old_{$table}");
        }
    }
    $query = "";
    while ($buffer = fgets($handle)) {
        $query .= $buffer;
        if (strpos($query, ";") !== false) {
            $query = str_replace(";", "", $query);
            Db::execute($query);
            $query = "";
        }
    }
    fclose($handle);
    if (Db::queryRow("SHOW TABLES LIKE 'old_{$table}'") != null) {
        // Check again to see if the old_table is there
        if (!Util::startsWith($table, "ccp_")) {
            try {
                Db::execute("insert ignore into {$table} select * from old_{$table}");
                Db::execute("drop table old_{$table}");
            } catch (Exception $ex) {
                Db::execute("drop table {$table}");
                Db::execute("alter table old_{$table} rename {$table}");
                throw $ex;
            }
        }
    }
}
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:39,代码来源:update.php

示例8: array

<?php

global $mdb;
$battleID = (int) $battleID;
//$battle = $mdb->findDoc("battles", ['battleID' => $battleID]);
$battle = Db::queryRow('select * from zz_battle_report where battleID = :id', array(':id' => $battleID));
$battle['battleID'] = (int) $battle['battleID'];
if (!$mdb->exists("battles", ['battleID' => $battleID])) {
    $mdb->save("battles", $battle);
}
$system = @$battle['solarSystemID'];
$time = @$battle['dttm'];
$options = @$battle['options'];
$showBattleOptions = false;
global $baseDir;
require_once $baseDir . '/view/related.php';
die;
开发者ID:nasimnabavi,项目名称:zKillboard,代码行数:17,代码来源:battle_report.php

示例9: array

<?php

$numDays = 7;
$campaign = Db::queryRow('select * from zz_campaigns where uri = :uri', array(':uri' => $uri), 1);
if ($campaign == null) {
    $app->redirect('/', 302);
}
$title = 'Campaign: ' . $campaign['title'];
$subTitle = $campaign['subTitle'];
$p = json_decode($campaign['definition'], true);
$summary = Summary::getSummary('system', 'solarSystemID', $p, 30000142, $p, true);
$topPoints = array();
$topPods = array();
$top = array();
$top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTopPilots($p, true));
$top[] = Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTopCorps($p, true));
$top[] = Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTopAllis($p, true));
$top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTopShips($p, true));
$top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTopSystems($p, true));
$p['pastSeconds'] = $numDays * 86400;
$p['limit'] = 5;
$topIsk = Stats::getTopIsk($p, true);
$topIsk['title'] = 'Most Valuable Kills';
unset($p['pastSeconds']);
// get latest kills
$killsLimit = 50;
$p['limit'] = $killsLimit;
if (isset($page) && $page > 0 && $page < 100) {
    $p['page'] = $page;
} else {
    $page = 1;
开发者ID:Nord001,项目名称:zKillboard,代码行数:31,代码来源:campaign.php

示例10: addItems

 public static function addItems(&$itemArray, $items, $killTime, $inContainer = 0, $parentFlag = 0)
 {
     if (is_array($items)) {
         foreach ($items as $item) {
             $typeID = $item["typeID"];
             $priceLookup = Db::queryRow("select * from zz_item_price_lookup where typeID = :typeID and priceDate = date(:date)", array(":typeID" => $typeID, ":date" => $killTime), 3600);
             $item["price"] = $priceLookup["price"];
             $item["inContainer"] = $inContainer;
             if ($inContainer) {
                 $item["flag"] = $parentFlag;
             }
             if ($inContainer && strpos(Info::getItemName($typeID), "Blueprint")) {
                 $item["singleton"] = 2;
             }
             unset($item["_stringValue"]);
             $itemArray[] = $item;
             $subItems = isset($item["items"]) ? $item["items"] : null;
             unset($item["items"]);
             if ($subItems != null) {
                 self::addItems($itemArray, $subItems, $killTime, 1, $item["flag"]);
             }
         }
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:24,代码来源:Kills.php

示例11: array

            Db::execute('UPDATE zz_users_crest SET userID = :userID WHERE characterID = :characterID', array(':userID' => $userID, ':characterID' => $characterID));
            // Update the characterID on zz_users and set merged to 1
            Db::execute('UPDATE zz_users SET merged = 1 WHERE id = :userID', array(':userID' => $userID));
            Db::execute('UPDATE zz_users SET characterID = :characterID WHERE id = :userID', array(':userID' => $userID, ':characterID' => $characterID));
            // Set the login session headers and whatnot
            $crestData = Db::queryRow('SELECT * FROM zz_users_crest WHERE characterID = :characterID', array(':characterID' => $characterID));
            $_SESSION['loggedin'] = $crestData['characterName'];
            // Redirect to /
            $app->redirect('/');
        } else {
            // The login failed, or the user didn't exist.. Either way, we don't give a fuck..
            // Randomly generate a password
            $password = md5(time() + $cookie_secret);
            // Insert no email address, null@null.com
            $email = 'null@null.com';
            // Data from zz_user_crest
            $crestData = Db::queryRow('SELECT * FROM zz_users_crest WHERE characterID = :characterID', array(':characterID' => $characterID));
            // Insert the new user to zz_users
            Db::execute('INSERT INTO zz_users (username, password, email, characterID, merged) VALUES (:username, :password, :email, :characterID, :merged)', array(':username' => $crestData['characterName'], ':password' => $password, ':email' => $email, ':characterID' => $crestData['characterID'], ':merged' => 1));
            // Set the userID in zz_users_crest
            $userID = Db::queryField('SELECT id FROM zz_users WHERE username = :username', 'id', array(':username' => $crestData['characterName']));
            Db::execute('UPDATE zz_users_crest SET userID = :userID WHERE characterID = :characterID', array(':userID' => $userID, ':characterID' => $characterID));
            // Set the session headers and whatnot
            $_SESSION['loggedin'] = $crestData['characterName'];
            // Redirect to /
            $app->redirect('/');
        }
    }
} elseif ($exists == 0 || $exists == null) {
    $app->render('merge.html', array('characterID' => $characterID, 'randomString' => $randomString));
}
开发者ID:Nord001,项目名称:zKillboard,代码行数:31,代码来源:merge.php

示例12: header

 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
if (!is_numeric($id)) {
    $id = Info::getItemId($id);
    if ($id > 0) {
        header("Location: /item/{$id}/");
    } else {
        header("Location: /");
    }
    die;
}
$info = Db::queryRow("select typeID, typeName, description from ccp_invTypes where typeID = :id", array(":id" => $id), 3600);
$info["description"] = str_replace("<br>", "\n", $info["description"]);
$info["description"] = strip_tags($info["description"]);
$hasKills = 1 == Db::queryField("select 1 as hasKills from zz_participants where shipTypeID = :id limit 1", "hasKills", array(":id" => $id), 3600);
$buyOrders = Db::query("select * from zz_marketdata where typeID = :typeID and bid = 1 order by price desc limit 10", array(":typeID" => $id));
$sellOrders = Db::query("select * from zz_marketdata where typeID = :typeID and bid = 0 order by price asc limit 10", array(":typeID" => $id));
$info["attributes"] = Db::query("SELECT categoryName, coalesce(displayName, attributeName) attributeName, coalesce(valueint,valuefloat) value  FROM ccp_invTypes JOIN ccp_dgmTypeAttributes ON (ccp_invTypes.typeid = ccp_dgmTypeAttributes.typeid) JOIN ccp_dgmAttributeTypes ON (ccp_dgmTypeAttributes.attributeid = ccp_dgmAttributeTypes.attributeid) LEFT JOIN ccp_dgmAttributeCategories ON (ccp_dgmAttributeTypes.categoryid=ccp_dgmAttributeCategories.categoryid) WHERE ccp_invTypes.typeid = :typeID and ccp_dgmAttributeCategories.categoryid is not null and displayName is not null and ccp_dgmAttributeTypes.categoryID not in (8,9) ORDER BY ccp_dgmAttributeCategories.categoryid,   ccp_dgmAttributeTypes.attributeid", array(":typeID" => $id));
Info::addInfo($buyOrders);
Info::addInfo($sellOrders);
$app->render("item.html", array("info" => $info, "hasKills" => $hasKills, "buyOrders" => $buyOrders, "sellOrders" => $sellOrders));
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:31,代码来源:item.php

示例13: get

 /**
  * @param $userID
  * @return array
  */
 public function get($userID)
 {
     return $this->db->queryRow("SELECT * FROM users WHERE userID = :userID", array(":userID" => $userID));
 }
开发者ID:sovereignbot,项目名称:citadel,代码行数:8,代码来源:Users.php

示例14: getSummary

 /**
  * @param string $type
  * @param string $column
  * @param array $data
  * @param integer $id
  * @param array $parameters
  * @return array
  */
 private static function getSummary($type, $column, &$data, $id, $parameters = array())
 {
     $key = "summary:{$type}:{$column}:{$id}:" . json_encode($parameters);
     $mc = Cache::get($key);
     if ($mc) {
         return $mc;
     }
     $rank = Db::queryRow("select * from zz_ranks where type = :type and typeID = :id", array(":type" => $type, ":id" => $id), 300);
     $recentRank = Db::queryField("select overallRank from zz_ranks_recent where type = :type and typeID = :id", "overallRank", array(":type" => $type, ":id" => $id), 300);
     $idCount = 0;
     foreach ($parameters as $key => $value) {
         if (Util::endsWith($key, "ID")) {
             $idCount++;
         }
     }
     if (false) {
         //isset($parameters["solo"]) || $idCount >= 2) {
         $rank = $recentRank = array();
         $tables = array();
         $whereClauses = array();
         if (!isset($parameters["kills"]) && !isset($parameters["losses"])) {
             $parameters["mixed"] = true;
         }
         Filters::buildFilters($tables, $whereClauses, $whereClauses, $parameters, true);
         $whereStatement = implode(" and ", $whereClauses);
         $query = "select groupID, sum(if(isVictim, 0, 1)) destroyed, sum(if(isVictim, 0, total_price)) iskDestroyed, sum(if(isVictim, 0, points)) pointsDestroyed, sum(if(isVictim, 1, 0)) lost, sum(if(isVictim, total_price, 0)) iskLost, sum(if(isVictim, points, 0)) pointsLost from (select vGroupID groupID, isVictim, total_price, points from zz_participants p where {$whereStatement} group by killID) as foo group by groupID";
         $stats = Db::query($query);
     } else {
         if ($type == "system" || $type == "region") {
             $stats = Db::query("select groupID, lost destroyed, 0 lost, pointsLost pointsDestroyed, 0 pointsLost, iskLost iskDestroyed, 0 iskLost from zz_stats where type='{$type}' and typeID = {$id}", array(":id" => $id), 300);
         } else {
             $stats = Db::query("select groupID, destroyed, lost, pointsDestroyed, pointsLost, iskDestroyed, iskLost from zz_stats where type='{$type}' and typeID = :id", array(":id" => $id), 0);
         }
     }
     $infoStats = array();
     $data["shipsDestroyed"] = 0;
     $data["shipsLost"] = 0;
     $data["pointsDestroyed"] = 0;
     $data["pointsLost"] = 0;
     $data["iskDestroyed"] = 0;
     $data["iskLost"] = 0;
     foreach ($stats as $stat) {
         $infoStat = Info::addInfo($stat);
         if ($infoStat["groupID"] == 0) {
             $infoStat["groupName"] = "Unknown";
         }
         $infoStats[$infoStat["groupName"]] = $infoStat;
         $data["shipsDestroyed"] += $infoStat["destroyed"];
         $data["shipsLost"] += $infoStat["lost"];
         $data["iskDestroyed"] += $infoStat["iskDestroyed"];
         $data["iskLost"] += $infoStat["iskLost"];
         $data["pointsDestroyed"] += $infoStat["pointsDestroyed"];
         $data["pointsLost"] += $infoStat["pointsLost"];
     }
     unset($stats);
     ksort($infoStats);
     $data["stats"] = $infoStats;
     if ($rank != null && $recentRank != null) {
         $rank["recentRank"] = $recentRank;
     }
     if ($rank != null) {
         $data["ranks"] = $rank;
     }
     Cache::set($key, $data, 300);
     return $data;
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:74,代码来源:Summary.php

示例15: commentID

 /**
  * [commentID description]
  * @param  int $id
  * @return int
  */
 public static function commentID($id)
 {
     // Find the old killID or EVE-KILL ID
     $checkID = $id;
     if ($checkID < 0) {
         $checkID = -1 * $checkID;
     }
     $okID = Db::queryRow("SELECT mKillID, killID, eveKillID FROM zz_manual_mails WHERE (mKillID = :mKillID OR killID = :killID)", array(":mKillID" => $checkID, ":killID" => $checkID));
     if (isset($okID["eveKillID"])) {
         $commentID = $okID["eveKillID"];
     } elseif (isset($okID["mKillID"])) {
         $commentID = $okID["mKillID"];
     } elseif (isset($okID["killID"])) {
         $commentID = $okID["killID"];
     } else {
         $commentID = $id;
     }
     return $commentID;
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:24,代码来源:Info.php


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