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


PHP Framework::getDb方法代码示例

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


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

示例1: escapeString

function escapeString($string)
{
    if (Framework::getDb() != null) {
        return mysql_real_escape_string($string, Framework::getDb()->getLink());
    }
    return mysql_escape_string($string);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:7,代码来源:functions.php

示例2: loadHits

 public function loadHits()
 {
     $page = $_SERVER['REQUEST_URI'];
     $rowAll = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "'");
     $rowToday = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "' AND added >= DATE_FORMAT('Y-m-d', NOW())");
     $rowMonth = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "' AND added >= DATE_FORMAT('Y-m', NOW())");
     $rowYear = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "' AND added >= DATE_FORMAT('Y', NOW())");
     $this->PageHits = array('all' => $rowAll ? $rowAll['hits'] : 0, 'today' => $rowToday ? $rowToday['hits'] : 0, 'month' => $rowMonth ? $rowMonth['hits'] : 0, 'hits' => $rowYear ? $rowYear['hits'] : 0);
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:9,代码来源:RoItem.class.php

示例3: save

 public function save()
 {
     // Add vender to the database or set to online
     $query = "SELECT char_id FROM " . self::TABLE . " WHERE char_id = '" . esc($this->id) . "'";
     $row = Framework::getDb()->getFirstRow($query);
     if ($row != null) {
         // Vender found, update it
         // Note: update name incase of name-change
         $query = "\n\t\t\t\t\tUPDATE " . self::TABLE . " SET \n\t\t\t\t\t\tname = '" . esc($this->name) . "', \n\t\t\t\t\t\tshopname = '" . esc($this->shopname) . "',\n\t\t\t\t\t\tposX = '" . esc($this->posX) . "', \n\t\t\t\t\t\tposY = '" . esc($this->posY) . "', \n\t\t\t\t\t\tposMap = '" . esc($this->posMap) . "', \n\t\t\t\t\t\tonline = 1,\n\t\t\t\t\t\tseen = NOW()\n\t\t\t\t\tWHERE char_id = '" . esc($this->id) . "'\n\t\t\t\t";
     } else {
         // New entry
         $query = "\n\t\t\t\t\tINSERT INTO " . self::TABLE . "\n\t\t\t\t\t\t(char_id, name, shopname, posX, posY, posMap, seen, online)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . esc($this->id) . "', '" . esc($this->name) . "', '" . esc($this->shopname) . "', '" . esc($this->posX) . "', '" . esc($this->posY) . "', '" . esc($this->posMap) . "', NOW(), '1')\n\t\t\t\t";
     }
     Framework::getDb()->query($query);
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:15,代码来源:ROVender.class.php

示例4: updateAvg

 private function updateAvg()
 {
     // Check if the item exists (item_id, refine, slots)
     $query = "SELECT * FROM " . self::TABLE_PRICE . " WHERE item_hash = '" . esc($this->getHash()) . "'";
     $row = Framework::getDb()->getFirstRow($query);
     if ($row != null) {
         // Found, update price sum (single price)
         $query = "UPDATE " . self::TABLE_PRICE . " SET price_sum = price_sum + " . esc($this->price_one) . ", `count` = `count` + 1 WHERE item_hash = '" . esc($this->getHash()) . "'";
         Framework::getDb()->query($query);
     } else {
         // Add new
         $query = "\n\t\t\t\t\t\tINSERT INTO `" . self::TABLE_PRICE . "` \n\t\t\t\t\t\t\t(`item_hash`, `item_id`, `price_sum`, `count`, `last_update`) \n\t\t\t\t\t\tVALUES \n\t\t\t\t\t\t\t('" . esc($this->getHash()) . "',  '" . esc($this->id) . "', '" . esc($this->price_one) . "', '1', NOW())";
         Framework::getDb()->query($query);
     }
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:15,代码来源:ROItem.class.php

示例5: resultToXML

 public static function resultToXML($result, $tagName, $filepath)
 {
     $doc = new DOMDocument();
     $doc->formatOutput = true;
     $items = $doc->createElement('items');
     $doc->appendChild($items);
     while ($row = Framework::getDb()->fetch($result)) {
         $item = $doc->createElement($tagName);
         foreach ($row as $key => $value) {
             $item->appendChild($doc->createElement($key, $value));
         }
         $items->appendChild($item);
     }
     if (@file_exists($filepath) == true) {
         unlink($filepath);
     }
     $doc->save($filepath);
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:18,代码来源:Util.class.php

示例6: set_time_limit

<?php

set_time_limit(0);
error_reporting(E_ALL);
define('NO_SESSION', true);
require_once '../../global.php';
// French
$data_fr = loadDescription('D:/Games/data/french/idnum2itemdesctable.txt');
// English (not yet done by fRO? Oo)
//$data_en = loadDescription('D:/Games/data/english/idnum2itemdesctable.txt');
// Import French
foreach ($data_fr as $ID => $lines) {
    echo '[FR] update #' . $ID . '<br />';
    $text = formatText($lines);
    Framework::getDb()->query("UPDATE item_db SET description_fr = '" . esc($text) . "' WHERE id = '" . esc($ID) . "'");
}
// Import english
/*
foreach ($data_en as $ID => $lines) {
	echo '[EN] update #' . $ID . '<br />';
	$text = implode("\n", $lines);
	Framework::getDb()->query("UPDATE item_db SET description_en = '" . esc($text) . "' WHERE id = '" . esc($ID) . "'");
}
*/
exit('done');
function loadDescription($filepath)
{
    $data = array();
    $lines = file($filepath);
    $currentID = null;
    foreach ($lines as $line) {
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:31,代码来源:import_desc.php

示例7: dirname

<?php

require_once dirname(__FILE__) . '/../../global.php';
$t = '##||##';
$vender = base64_encode(1) . $t . base64_encode('GodLesZ') . $t . base64_encode('ROPrice test') . $t . base64_encode(159) . $t . base64_encode(159) . $t . base64_encode('prontera');
$result = Framework::getDb()->fetchAll("SELECT * FROM item_db WHERE id >= 501 AND id <= 510");
foreach ($result as $row) {
    $h = fopen('data/data_' . date('Y-m-d_H-i') . '_' . rand() . '.txt', 'w+');
    // Build random
    $price = $row['price_buy'] + (rand(1, 2) == 1 ? rand(10, 100) : 0);
    $amount = rand(10, 100);
    $price *= $amount;
    // In RO we get the price for all items
    $refine = 0;
    $card0 = 0;
    $card1 = 0;
    $card2 = 0;
    $card3 = 0;
    $item = base64_encode($row['id']) . $t . base64_encode($row['name_japanese']) . $t . base64_encode($price) . $t . base64_encode($amount) . $t . base64_encode($refine) . $t . base64_encode($card0) . $t . base64_encode($card1) . $t . base64_encode($card2) . $t . base64_encode($card3);
    $line = $vender . "\t" . $item . "\n";
    fwrite($h, $line);
    fclose($h);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:23,代码来源:test.php

示例8: getDb

 public function getDb()
 {
     return Framework::getDb();
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:4,代码来源:AbstractPage.class.php

示例9: updateDatabase

 public function updateDatabase($debug = false)
 {
     $keys = array();
     $values = array();
     $query = '';
     if ($this->ID == null) {
         foreach ($this->_Params as $key => $propertie) {
             if ($this->{$propertie} != null) {
                 $keys[] = '`' . $key . '`';
                 $values[] = "'" . escapeString($this->{$propertie}) . "'";
             }
         }
         $query = "INSERT INTO `" . $this->getDBName() . "` (" . implode(', ', $keys) . ") VALUES (" . implode(', ', $values) . ")";
         Framework::getDb()->query($query);
         if (($lastID = Framework::getDb()->getLastID()) != 0) {
             $this->ID = $lastID;
         }
     } else {
         foreach ($this->_Params as $key => $propertie) {
             if ($key != 'id') {
                 $values[] = "`" . $key . "` = '" . escapeString($this->{$propertie}) . "'";
             }
         }
         $query = "UPDATE `" . $this->getDBName() . "` SET " . implode(', ', $values) . " WHERE `id` = '" . escapeString($this->ID) . "'";
         if ($debug == true) {
             echo '<pre>';
             //print_r($this);
             echo '<strong>Query</strong>: ' . $query . '<br />';
             echo '</pre>';
         }
         Framework::getDb()->query($query);
     }
     return true;
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:34,代码来源:DatabaseObject.class.php


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