當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBLayer::query方法代碼示例

本文整理匯總了PHP中DBLayer::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBLayer::query方法的具體用法?PHP DBLayer::query怎麽用?PHP DBLayer::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBLayer的用法示例。


在下文中一共展示了DBLayer::query方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkInputValues

function checkInputValues()
{
    global $fdb;
    // Check connection
    $conn = @mysql_connect($_SESSION['hostname'], $_SESSION['username'], $_SESSION['password']);
    if (!$conn) {
        myerror('Unable to connect to MySQL server. Please check your settings again.<br><br><a href="?page=settings">Go back to settings</a>');
    }
    // Check databases
    if (!@mysql_select_db($_SESSION['php_db_clean'], $conn)) {
        // Fetch database list
        $list = '';
        $result = @mysql_query('SHOW databases', $conn);
        while ($ob = mysql_fetch_row($result)) {
            $list .= ' &nbsp <a href="?page=settings&newdb=' . $ob[0] . '">' . $ob[0] . '</a><br>' . "\n";
        }
        // Close connection and show message
        mysql_close($conn);
        myerror('Unable to select database.' . '<br><br>Found these databases:<br><font color="gray">' . $list . '</font>' . '<br><a href="?page=settings">Go back to settings</a>');
    }
    mysql_close($conn);
    // Include FORUM's config file
    include './' . $_SESSION['forum'] . '/_config.php';
    // Check prefix
    $fdb = new DBLayer($_SESSION['hostname'], $_SESSION['username'], $_SESSION['password'], $_SESSION['php_db_clean'], $_SESSION['php_prefix'], false);
    $res = $fdb->query('SELECT count(*) FROM ' . $_SESSION['php'] . $tables['Users']);
    if (intval($fdb->result($res, 0)) == 0) {
        // Select a list of tables
        $list = array();
        $res = $fdb->query('SHOW TABLES IN ' . $_SESSION['php_db']);
        while ($ob = $fdb->fetch_row($res)) {
            $list[] = $ob[0];
        }
        // check list size
        sizeof($list) == 0 ? $list[] = 'None' : null;
        // Get list of "proabable" prefixes
        $prefix_list = '';
        $res = $fdb->query('SHOW TABLES FROM ' . $_SESSION['php_db'] . ' LIKE \'%' . $tables['Posts'] . '\'') or myerror('Unable to fetch table list', __FILE__, __LINE__, $fdb->error());
        //			$res = $fdb->query('SHOW TABLES FROM '.$_SESSION['php_db'].' LIKE \'%'.$tables['Users'].'\'') or myerror('Unable to fetch table list', __FILE__, __LINE__, $fdb->error());
        while ($ob = $fdb->fetch_row($res)) {
            $prefix = substr($ob[0], 0, strlen($ob[0]) - strlen($tables['Users']));
            $prefix_list .= ' &nbsp; <a href="?page=settings&newprefix=' . $prefix . '">' . $prefix . '</a><br>' . "\n";
        }
        // Print message
        $prefix = $_SESSION['php_prefix'] == '' ? 'no' : '\'' . $_SESSION['php_prefix'] . '\'';
        myerror('Unable to find ' . $_SESSION['forum'] . ' tables! (using prefix: <i>' . $prefix . '</i>)' . '<br><br>Go back to settings and choose another prefix, or select one of these prefixes:<br><font color="gray">' . $prefix_list . '</font>' . '<br>These are the tables in the selected database:<br><font color="gray"> &nbsp; ' . implode("<br> &nbsp; ", $list) . '</font>' . '<br><br><a href="?page=settings">Go back to settings</a>');
    }
}
開發者ID:neofutur,項目名稱:MyBestBB,代碼行數:48,代碼來源:functions.php

示例2: isKnownUser

function isKnownUser($username, $userpass = null)
{
    global $db, $CNF;
    //    echo $username;
    if (strlen($username) > 0) {
        $db = new DBLayer($CNF["db_host"], $CNF["db_user"], $CNF["db_pass"], $CNF["db_name"]);
        $db->query("SET NAMES utf8");
        $sql_pass = $userpass != null ? "`status_id` !=4 AND `pass`='{$userpass}'" : '`status_id` !=4';
        $query = $db->query("SELECT `uid`,`login`,`lastname`,`firstname`,`middlename` FROM users WHERE `login`='{$username}' AND {$sql_pass}");
        if ($db->num_rows($query) > 0) {
            $auth = $db->fetch_assoc($query);
            return $auth;
        }
    }
    return false;
}
開發者ID:progervlad,項目名稱:utils,代碼行數:16,代碼來源:subs.php

示例3: alter_table

 /**
 Allows the dev to modify the structure of a table:
 Supported operations:
 
 - add_field
 - drop_field
 */
 protected function alter_table($tname, $params)
 {
     global $__db_conn;
     foreach ($params as $operation => $parms) {
         switch ($operation) {
             case "add_field":
                 $keys = array_keys($parms);
                 $new_field = $keys[0];
                 $type = $this->sql_types_mapping[$parms[$new_field]];
                 $sql = "ALTER TABLE {$tname} ADD COLUMN {$new_field} {$type}";
                 break;
             case "drop_field":
                 $new_field = $parms;
                 $sql = "ALTER TABLE {$tname} drop column {$new_field} ";
                 break;
             default:
                 break;
         }
         Makiavelo::info("Altering table :: " . $sql);
         DBLayer::query($sql);
     }
 }
開發者ID:quyen91,項目名稱:lfpr,代碼行數:29,代碼來源:MigrationClass.php

示例4: DBLayer

} else {
    $lang = $language;
}
$database_encoding = $site_encoding;
$server = $server_arr[$realm_id]["addr"];
$port = $server_arr[$realm_id]["game_port"];
$host = $characters_db[$realm_id]["addr"];
$user = $characters_db[$realm_id]["user"];
$password = $characters_db[$realm_id]["pass"];
$db = $characters_db[$realm_id]["name"];
$hostr = $realm_db["addr"];
$userr = $realm_db["user"];
$passwordr = $realm_db["pass"];
$dbr = $realm_db["name"];
$sql = new DBLayer($hostr, $userr, $passwordr, $dbr);
$query = $sql->query("SELECT name FROM realmlist WHERE id = " . $realm_id);
$realm_name = $sql->fetch_assoc($query);
$realm_name = htmlentities($realm_name["name"]);
$gm_show_online = $gm_online;
$gm_show_online_only_gmoff = $map_gm_show_online_only_gmoff;
$gm_show_online_only_gmvisible = $map_gm_show_online_only_gmvisible;
$gm_add_suffix = $map_gm_add_suffix;
$gm_include_online = $gm_online_count;
$show_status = $map_show_status;
$time_to_show_uptime = $map_time_to_show_uptime;
$time_to_show_maxonline = $map_time_to_show_maxonline;
$time_to_show_gmonline = $map_time_to_show_gmonline;
$status_gm_include_all = $map_status_gm_include_all;
$time = $map_time;
$show_time = $map_show_time;
// points located on these maps(do not modify it)
開發者ID:BACKUPLIB,項目名稱:minimanager,代碼行數:31,代碼來源:pomm_conf.php

示例5: translit

<?php

/**
 * Created by PhpStorm.
 * User: megadozz
 * Date: 01.07.2014
 * Time: 10:54
 */
ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
//echo "$_SERVER[DOCUMENT_ROOT]";
require_once "{$_SERVER['DOCUMENT_ROOT']}/lib/dblayer.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/conf.inc.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/subs.php";
$db = new DBLayer($CNF["db_host"], $CNF["db_user"], $CNF["db_pass"], $CNF["db_name"]);
$db->query("SET NAMES utf8");
function translit($str)
{
    $tr = array("А" => "A", "Б" => "B", "В" => "V", "Г" => "G", "Д" => "D", "Е" => "E", "Ё" => "E", "Ж" => "ZH", "З" => "Z", "И" => "I", "Й" => "Y", "К" => "K", "Л" => "L", "М" => "M", "Н" => "N", "О" => "O", "П" => "P", "Р" => "R", "С" => "S", "Т" => "T", "У" => "U", "Ф" => "F", "Х" => "H", "Ц" => "TS", "Ч" => "CH", "Ш" => "SH", "Щ" => "SCH", "Ъ" => "", "Ы" => "YI", "Ь" => "", "Э" => "E", "Ю" => "YU", "Я" => "YA", "а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", "ё" => "e", "ж" => "zh", "з" => "z", "и" => "i", "й" => "y", "к" => "k", "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f", "х" => "h", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch", "ъ" => "y", "ы" => "yi", "ь" => "", "э" => "e", "ю" => "yu", "я" => "ya");
    return strtr($str, $tr);
}
function generate_password($length)
{
    $pass = "";
    $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    for ($i = 0; $i < $length; $i++) {
        $index = rand(0, count($arr) - 1);
        // Случайный индекс массива
        $pass .= $arr[$index];
    }
    return $pass;
開發者ID:progervlad,項目名稱:utils,代碼行數:31,代碼來源:create_users_shadows.php

示例6: array

$Horde_races = 0x2b2;
$Alliance_races = 0x44d;
$outland_inst = array(540, 542, 543, 544, 545, 546, 547, 548, 550, 552, 553, 554, 555, 556, 557, 558, 559, 562, 564, 565);
$northrend_inst = array(533, 574, 575, 576, 578, 599, 600, 601, 602, 603, 604, 608, 615, 616, 617, 619, 624);
require_once "../libs/js/JsHttpRequest/Php.php";
$JsHttpRequest = new Subsys_JsHttpRequest_Php("utf-8");
$arcm_db_PM = new DBLayer($hostr, $userr, $passwordr, $dbr);
if (!$arcm_db_PM->isValid()) {
    $_RESULT['status']['online'] = 2;
    exit;
}
$logon_db_PM = new DBLayer($hostl, $userl, $passwordl, $dbl);
$arcm_db_PM->query("SET NAMES {$database_encoding}");
$gm_online = 0;
$gm_accounts = array();
$query = $logon_db_PM->query("SELECT GROUP_CONCAT(`acct` SEPARATOR ' ') FROM `accounts` WHERE `gm`<>'0'");
if ($query) {
    if ($result = $logon_db_PM->fetch_row($query)) {
        $gm_accounts = explode(' ', $result[0]);
    }
}
$groups = array();
$characters_db_PM = new DBLayer($host, $user, $password, $db);
if (!$characters_db_PM->isValid()) {
    $_RESULT['status']['online'] = 2;
    exit;
}
$characters_db_PM->query("SET NAMES {$database_encoding}");
$query = $characters_db_PM->query("SELECT `leaderGuid`,`memberGuid` FROM `group_member` WHERE `memberGuid` IN(SELECT `guid` FROM `characters` WHERE `online`='1')");
if ($query) {
    while ($result = $characters_db_PM->fetch_assoc($query)) {
開發者ID:Refuge89,項目名稱:World-of-Warcraft-Trinity-Core-MaNGOS,代碼行數:31,代碼來源:pomm_play.php

示例7: count

    require_once "map_english.php";
}
$_RESULT = NULL;
$maps_count = count($lang_defs['maps_names']);
$Horde_races = 0x2b2;
$Alliance_races = 0x44d;
$outland_inst = array(540, 542, 543, 544, 545, 546, 547, 548, 550, 552, 553, 554, 555, 556, 557, 558, 559, 562, 564, 565);
$northrend_inst = array(533, 574, 575, 576, 578, 599, 600, 601, 602, 603, 604, 608, 615, 616, 617, 619, 624);
require_once "../libs/js/JsHttpRequest/Php.php";
$JsHttpRequest = new Subsys_JsHttpRequest_Php("utf-8");
$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr);
if (!$realm_db->isValid()) {
    $_RESULT['status']['online'] = 2;
    exit;
}
$realm_db->query("SET NAMES {$database_encoding}");
$gm_online = 0;
$gm_accounts = array();
$query = $realm_db->query("SELECT GROUP_CONCAT(`id` SEPARATOR ' ') FROM `account` WHERE `gmlevel`>'0'");
if ($query) {
    if ($result = $realm_db->fetch_row($query)) {
        $gm_accounts = explode(' ', $result[0]);
    }
}
$groups = array();
$characters_db = new DBLayer($host, $user, $password, $db);
if (!$characters_db->isValid()) {
    $_RESULT['status']['online'] = 2;
    exit;
}
$characters_db->query("SET NAMES {$database_encoding}");
開發者ID:scamp,項目名稱:minimanager,代碼行數:31,代碼來源:pomm_play.php

示例8: error

     case 'mysqli':
         break;
     case 'pgsql':
         // Make sure we are running at least PHP 4.3.0 (needed only for PostgreSQL)
         if (version_compare(PHP_VERSION, '4.3.0', '<')) {
             error('You are running PHP version ' . PHP_VERSION . '. PunBB requires at least PHP 4.3.0 to run properly when using PostgreSQL. You must upgrade your PHP installation or use a different database before you can continue.');
         }
         break;
     case 'sqlite':
         if (strtolower($db_prefix) == 'sqlite_') {
             error('The table prefix \'sqlite_\' is reserved for use by the SQLite engine. Please choose a different prefix.');
         }
         break;
 }
 // Make sure PunBB isn't already installed
 $result = $db->query('SELECT 1 FROM ' . $db_prefix . 'users WHERE id=1');
 if ($db->num_rows($result)) {
     error('A table called "' . $db_prefix . 'users" is already present in the database "' . $db_name . '". This could mean that PunBB is already installed or that another piece of software is installed and is occupying one or more of the table names PunBB requires. If you want to install multiple copies of PunBB in the same database, you must choose a different table prefix.');
 }
 // Create all tables
 switch ($db_type) {
     case 'mysql':
     case 'mysqli':
         $sql = 'CREATE TABLE ' . $db_prefix . "bans (\n\t\t\t\t\tid INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t\t\tusername VARCHAR(200),\n\t\t\t\t\tip VARCHAR(255),\n\t\t\t\t\temail VARCHAR(50),\n\t\t\t\t\tmessage VARCHAR(255),\n\t\t\t\t\texpire INT(10) UNSIGNED,\n\t\t\t\t\tPRIMARY KEY (id)\n\t\t\t\t\t) TYPE=MyISAM;";
         break;
     case 'pgsql':
         $db->start_transaction();
         $sql = 'CREATE TABLE ' . $db_prefix . "bans (\n\t\t\t\t\tid SERIAL,\n\t\t\t\t\tusername VARCHAR(200),\n\t\t\t\t\tip VARCHAR(255),\n\t\t\t\t\temail VARCHAR(50),\n\t\t\t\t\tmessage VARCHAR(255),\n\t\t\t\t\texpire INT,\n\t\t\t\t\tPRIMARY KEY (id)\n\t\t\t\t\t)";
         break;
     case 'sqlite':
         $db->start_transaction();
開發者ID:BackupTheBerlios,項目名稱:vnkb-applet-svn,代碼行數:31,代碼來源:install.php

示例9: isset

 * TEST authentication page
 */
ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
session_start();
require "subs.php";
require "conf.inc.php";
require "lib/dblayer.php";
$stage = isset($_REQUEST["stage"]) ? check_string($_REQUEST["stage"], "string") : null;
// Стадия
// Авторизация
global $CNF;
//echo $stage;
if ($stage == "auth") {
    $db = new DBLayer($CNF["db_host"], $CNF["db_user"], $CNF["db_pass"], $CNF["db_name"]);
    $db->query("SET NAMES utf8");
    $login = check_string($_REQUEST["login"], "string");
    $pass_hash = md5($_REQUEST["pass"]);
    //    echo    "SELECT `uid` FROM users WHERE `login`='$login' AND `pass_hash`='$pass_hash'";
    $query_auth = $db->query("SELECT `uid` FROM users WHERE `login`='{$login}' AND `pass_hash`='{$pass_hash}'");
    $db->num_rows($query_auth);
    if ($query_auth and $db->num_rows($query_auth) == 1) {
        $admin_login = $db->fetch_assoc($query_auth);
        //        $hash = md5(microtime()); // Случайная строка-хеш (32-символа)
        //        $db -> query("UPDATE admins SET `hash`='".$hash."' WHERE `uid`='".$admin_login['uid']."'"); // Запись хеша в БД
        # Печеньки:
        $cookie_lifetime = isset($_REQUEST["remember"]) == "on" ? strtotime("+1 year") : 0;
        // Время жизни: 1 год или 0 - до закрытия броузера
        setcookie("user_id", $admin_login['uid'], $cookie_lifetime);
        setcookie("hash", $pass_hash, $cookie_lifetime);
        unset($stage, $_POST["name"], $_POST["pass"], $_REQUEST["stage"]);
開發者ID:progervlad,項目名稱:utils,代碼行數:31,代碼來源:auth.php

示例10: header

    // Load forum specific settings
    if (file_exists('./' . $_SESSION['forum'] . '/_settings.php')) {
        include './' . $_SESSION['forum'] . '/_settings.php';
    }
    // Limit
    $_SESSION['limit'] = 100;
    // Load all forum common start file
    require 'start.php';
    // Redirect to first forum convert file
    header('Location: index.php?step=' . $parts[0]);
}
// Connect to database (might be the same as fluxbb uses)
if (isset($page) && $page != 'settings' || isset($step)) {
    $fdb = new DBLayer($_SESSION['hostname'], $_SESSION['username'], $_SESSION['password'], $_SESSION['php_db'], $_SESSION['php_prefix'], false);
    if ($_SESSION['old_charset'] != '' && $_SESSION['old_charset'] != 'UTF-8') {
        $fdb->query('SET NAMES \'latin1\'') or myerror("Unable to set names", __FILE__, __LINE__, $fdb->error());
    }
}
// Header
require 'header.php';
?>

	<table class="punmain" cellspacing="1" cellpadding="4">

<?php 
//	Check for the lock-file
if (file_exists('LOCKED') && (!isset($page) || $page != 'done')) {
    conv_message('This converter is locked to prevent other users to alter the databases.<br><br>Please remove the file \'LOCKED\' in the converter directory and reload this page to run the converter again. If you are done with the converter, it\'s okay to remove the entire directory instead.');
    exit;
}
// Load the proper page
開發者ID:bowu8,項目名稱:fluxbb-converters,代碼行數:31,代碼來源:index.php

示例11: DBLayer

<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/lib/dblayer.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/subs.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/conf.inc.php";
$db = new DBLayer($CNF["db_host"], $CNF["db_user"], $CNF["db_pass"], $CNF["db_name"]);
$db->query("SET NAMES utf8");
$action = checkRequest("action");
$domain = checkRequest("domain");
$username = checkRequest("username");
$user_id = getUserByUsername($username)['uid'];
if ($user_id < 1) {
    $user_id = createUser($username);
}
$workstation = mb_strtolower(checkRequest("workstation"), "UTF-8");
$ip = trim(checkRequest("ip"));
$workstation_id = strlen($workstation) > 0 ? checkWorkstation($workstation, $ip) : null;
switch ($action) {
    case "start":
        logonWorkstation($workstation_id, $ip);
        break;
    case "shutdown":
        echo "ws: {$workstation_id}, IP: {$ip}";
        logoffWorkstation($workstation_id);
        break;
    case "logon":
        echo $workstation_id;
        logonWorkstation($workstation_id, $ip);
        logonUser($user_id, $domain, $workstation_id);
        break;
    case "logoff":
開發者ID:progervlad,項目名稱:utils,代碼行數:31,代碼來源:logons.php

示例12: error

         require FORUM_ROOT . 'include/dblayer/sqlite3.php';
         break;
     default:
         error(sprintf($lang_install['No such database type'], forum_htmlencode($db_type)));
 }
 // Create the database object (and connect/select db)
 $forum_db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
 // If MySQL, make sure it's at least 4.1.2
 if (in_array($db_type, array('mysql', 'mysqli', 'mysql_innodb', 'mysqli_innodb'))) {
     $mysql_info = $forum_db->get_version();
     if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) {
         error(sprintf($lang_install['Invalid MySQL version'], forum_htmlencode($mysql_info['version']), MIN_MYSQL_VERSION));
     }
     // Check InnoDB support in DB
     if (in_array($db_type, array('mysql_innodb', 'mysqli_innodb'))) {
         $result = $forum_db->query('SHOW VARIABLES LIKE \'have_innodb\'');
         $row = $forum_db->fetch_assoc($result);
         if (!$row || !isset($row['Value']) || strtolower($row['Value']) != 'yes') {
             error($lang_install['MySQL InnoDB Not Supported']);
         }
     }
 }
 // Validate prefix
 if (strlen($db_prefix) > 0 && (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $db_prefix) || strlen($db_prefix) > 40)) {
     error(sprintf($lang_install['Invalid table prefix'], $db_prefix));
 }
 // Check SQLite prefix collision
 if (in_array($db_type, array('sqlite', 'sqlite3')) && strtolower($db_prefix) == 'sqlite_') {
     error($lang_install['SQLite prefix collision']);
 }
 // Make sure PunBB isn't already installed
開發者ID:heiswayi,項目名稱:ishare-plus,代碼行數:31,代碼來源:install.php

示例13: DBLayer

 function get_character_honor($char_id)
 {
     global $hostr, $userr, $passwordr, $db, $dbr, $dbc, $database_encoding;
     $mangos_db = new DBLayer($hostr, $userr, $passwordr, $dbc);
     $query = $mangos_db->query("SELECT * FROM `character_kill` WHERE `guid`='{$char_id}'");
     while ($res_row = $mangos_db->fetch_assoc($query)) {
         $honor += $res_row['honor'];
     }
     $mangos_db->close();
     return $honor;
 }
開發者ID:galathil,項目名稱:coolwow2,代碼行數:11,代碼來源:fonctions.php

示例14: DBLayer

<?php

require "subs.php";
require_once "conf.inc.php";
require_once "lib/dblayer.php";
$btn_home = "<a class='button' href='./'><<</a>";
$db = new DBLayer($CNF["db_host"], $CNF["db_user"], $CNF["db_pass"], $CNF["db_name"]);
$db->query("SET NAMES utf8");
$q = "SELECT\n                u.`uid`,\n                u.`modiff`,\n                DATE_FORMAT(u.`modiff`,'%d.%m.%Y %H:%i:%s') AS `modiff_fmt`,\n                (SELECT CONCAT(`lastname`,' ',`firstname`) FROM users WHERE `uid`=u.`modiff_uid`) AS `modiff_uid`,\n                u.`status_id`,\n                u.`lastname`,\n                u.`firstname`,\n                u.`middlename`,\n                u.`login`,\n                u.`pass`\n                         FROM users AS u ORDER BY `uid` DESC LIMIT 5";
if ($qry = $db->query($q)) {
    eval(tmplt_gen("stat/forms/begin.form"));
    eval(tmplt_gen("users/forms/filter.form"));
    while ($res = $db->fetch_assoc($qry)) {
        $page .= table_users($res);
    }
    $page .= "</table>";
    $page .= "<div class='table-footer'><span class='statusbar'>&nbsp;</span>";
} else {
    echo 'error';
}
//print_r($res);
echo $page;
$db_err = $db->error();
$db->close();
if ($db_err["error_no"] != null) {
    print_r($db_err);
}
// DB-errors
開發者ID:progervlad,項目名稱:utils,代碼行數:28,代碼來源:test.php

示例15: isset

        $arr[$i]['cl'] = $result['class'];
        $arr[$i]['race'] = $result['race'];
        $arr[$i]['level'] = $char_data[$UNIT_FIELD_LEVEL];
        $arr[$i]['gender'] = $char_gender[3];
        $arr[$i]['Extention'] = $Extention;
        $arr[$i]['leaderGuid'] = isset($groups[$char_data[0]]) ? $groups[$char_data[0]] : 0;
        $i++;
    }
    $mangos_db->close();
    usort($arr, "sort_players");
    $arr = array_merge($Count, $arr);
    $res['online'] = $arr;
} else {
    $res['online'] = NULL;
}
if ($show_status) {
    $mangos_db = new DBLayer($mangos[$royaume]['host'], $mangos[$royaume]['user'], $mangos[$royaume]['password'], $mangos[$royaume]['db']);
    $mangos_db->query("SET NAMES " . $mangos[$royaume]['encoding'] . "");
    $query = $mangos_db->query("SELECT `starttime`,`maxplayers` FROM `uptime` WHERE `starttime`=(SELECT MAX(`starttime`) FROM `uptime`)");
    if ($result = $mangos_db->fetch_assoc($query)) {
        $status['uptime'] = time() - $result['starttime'];
        $status['maxplayers'] = $result['maxplayers'];
        $status['online'] = test_realm() ? 1 : 0;
    }
    $mangos_db->close();
} else {
    $status = NULL;
}
unset($mangos_db);
$res['status'] = $status;
$_RESULT = $res;
開發者ID:galathil,項目名稱:coolwow2,代碼行數:31,代碼來源:map_core.php


注:本文中的DBLayer::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。