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


PHP database::fetch_row方法代码示例

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


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

示例1: getUserById

 public static function getUserById($user_id)
 {
     if (safe_input::is_number($user_id)) {
         $db = new database();
         $db->select("user", "*", "id= {$user_id} ");
         if ($db->number_of_rows() > 0) {
             return $db->fetch_row();
         } else {
             return FALSE;
         }
     } else {
         return false;
     }
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:14,代码来源:table_user.php

示例2: database

require_once "global_func.php";
global $_CONFIG;
define("MONO_ON", 1);
require_once "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
include_once 'lib/config.php';
$user = User::fbc_getLoggedIn();
$user ? $fb_active_session = $user->fbc_is_session_active() : ($fb_active_session = FALSE);
include "sb_func.php";
include $gpre . "func.php";
$currenttime = time();
$is = $db->query("SELECT * FROM users WHERE userid={$_SESSION['userid']}");
$ir = $db->fetch_row($is);
$userid = $ir['userid'];
$roomid = abs((int) $_POST['id']);
if (!$roomid) {
    $roomid = abs((int) $_GET['id']);
}
if ($roomid) {
    $goodroom = $db->num_rows($db->query("SELECT id FROM {$gpre}room WHERE (p1={$userid} OR p2={$userid}) AND id={$roomid}"));
    if (!$goodroom) {
        die('Error. Bad room ID.');
    }
} else {
    $roomid = $ir["{$gpre}room"];
}
$move = abs((int) $_POST['move']);
$begin = abs((int) $_POST['begin']);
开发者ID:marcfeather,项目名称:Multiplayer-PHP-Ajax-Games,代码行数:31,代码来源:st_play.php

示例3: get_all_pending_games

 public static function get_all_pending_games()
 {
     $query = "SELECT * FROM `pending_game`";
     $db = new database();
     $db->query($query);
     if ($db->number_of_rows() > 0) {
         while ($pgame = $db->fetch_row()) {
             $pgames[] = $pgame;
         }
         return $pgames;
     } else {
         return null;
     }
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:14,代码来源:table_pending_game.php

示例4: Copyright

|**************************************************************************************************
| Copyright (c) 2010 Ravan Scripts . All rights reserved.
|**************************************************************************************************/
include "config.php";
include "language.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$db->query("UPDATE fedjail set fed_days=fed_days-1");
$q = $db->query("SELECT * FROM fedjail WHERE fed_days=0");
$ids = array();
while ($r = $db->fetch_row($q)) {
    $ids[] = $r['fed_userid'];
}
if (count($ids) > 0) {
    $db->query("UPDATE users SET fedjail=0 WHERE userid IN(" . implode(",", $ids) . ")");
}
$db->query("DELETE FROM fedjail WHERE fed_days=0");
$db->query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 0");
$db->query("UPDATE users SET daysold=daysold+1, boxes_opened=0");
$db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0");
$db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0");
$db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0");
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0");
$db->query("UPDATE users SET turns=25");
$db->query("UPDATE users SET rob=0");
开发者ID:Rizwan1738,项目名称:Mafia-Game-Script,代码行数:31,代码来源:cron_run_day.php

示例5: database

    exit;
}
$userid = $_SESSION['userid'];
$staff = 1;
require "header.php";
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
while ($r = $db->fetch_row($settq)) {
    $set[$r['conf_name']] = $r['conf_value'];
}
$domain = $_SERVER['HTTP_HOST'];
$is = $db->query("SELECT * FROM users WHERE userid={$userid}");
$ir = $db->fetch_row($is);
if ($ir['user_level'] <= 1) {
    print "403: Access Denied";
    $h->endpage();
    exit;
}
$h = new headers();
$h->startheaders();
$fm = number_format($ir['money'], 2);
$fm = "\$" . $fm;
$lv = date('F j, Y, g:i a', $ir['laston']);
开发者ID:marcfeather,项目名称:Multiplayer-PHP-Ajax-Games,代码行数:31,代码来源:sglobals.php

示例6: database

	check/award win
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
session_start();
require_once "config.php";
require_once "global_func.php";
global $_CONFIG;
define("MONO_ON", 1);
require_once "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$is = $db->query("SELECT * FROM users WHERE userid={$_SESSION['userid']}");
$ir = $db->fetch_row($is);
$userid = $ir['userid'];
include "s_{$gpre}func.php";
$pp = $db->query("SELECT * FROM {$gpre}game WHERE gameover=0 AND userid={$userid}");
$pany = $db->num_rows($pp);
$move = abs((int) $_POST['move']);
$select = abs((int) $_POST['select']);
print "<center>";
//This code is essentially the code that executes in the if($pany && $_GET['act']=='play') statement within s_pp_game.php
if ($pany) {
    $p = $db->fetch_row($pp);
    print "<h2>Poker Patience</h2><a href='s_pp_game.php?act=highscores'><b><font color=green>View Highscores</font></b></a> | \n\t<b>How to play:</b><br /><font size=1> Get the best 5 card hand possible on each row, column, and the two diagonals. <br />\n\tYour final score is the total points you earned from all 12 of those hands.<br />\n\tClick one of the two decks at top to select a card to play, and click an open square to play it.</font><br /><br />\n\t<div id = \"gamediv\">";
    $gameid = $p['id'];
    $boardtxt = draw_board($userid, $gameid);
    if ($move != 0 && $p['gameover'] == 0) {
        make_move($move, $userid);
开发者ID:marcfeather,项目名称:Multiplayer-PHP-Ajax-Games,代码行数:31,代码来源:s_pp_play.php

示例7: header

    }
}
require "global_func.php";
if ($_SESSION['loggedin'] == 0) {
    header("Location: login.php");
    exit;
}
$userid = $_SESSION['userid'];
include "config.php";
include "language.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$is = $db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$userid}");
$ir = $db->fetch_row($is);
$q = $db->query("SELECT * FROM votes WHERE userid={$userid} AND list='trpg'");
if ($db->num_rows($q)) {
    print "You have already voted at TOPRPG today!";
} else {
    $db->query("INSERT INTO votes values ({$userid},'trpg')");
    $db->query("UPDATE users SET money=money+300 WHERE userid={$userid}");
    header("Location:http://www.toprpgames.com/vote.php?idno=");
    exit;
}
?>

开发者ID:Rizwan1738,项目名称:Mafia-Game-Script,代码行数:29,代码来源:votetrpg.php

示例8: header

    header("Location: news.php");
    exit;
}
include "config.php";
global $_CONFIG, $affID;
define("MONO_ON", 1);
require "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
if ($_GET['p'] != 'jillybeanroxmysox') {
    die("nogo");
}
$dd = $db->query("SELECT * FROM cashin");
$ss = $db->fetch_row($dd);
$db->query("UPDATE cashin SET totmembership=totmembership+{$ss['membership']},membership=0,totreferral=totreferral+{$ss['referral']},referral=0,totads=totads+{$ss['ads']},ads=0,totbidvert=totbidvert+{$ss['bidvert']},bidvert=0,paid=0");
$hy = $db->fetch_row($db->query("SELECT topscore FROM cashin"));
$x = $hy['topscore'];
$a = $db->query("SELECT id,game FROM flash2 WHERE accepted=1");
while ($b = $db->fetch_row($a)) {
    $i = 0;
    $c = $db->query("SELECT * from highscores WHERE gameid={$b['id']} ORDER BY score DESC LIMIT 3");
    while ($d = $db->fetch_row($c)) {
        $i++;
        // place of person
        //$db->query("INSERT INTO arcadetrophy VALUES('',{$d['userid']},{$d['gameid']},{$d['score']},$i,unix_timestamp(),'{$b['game']}')");
        //determine $x or money by place
        if ($i == 1) {
            $x = 50;
            $pla = '1st';
开发者ID:marcfeather,项目名称:Multiplayer-PHP-Ajax-Games,代码行数:31,代码来源:cronrunthemmonths.php

示例9: foreach

    foreach ($_GET as $k => $v) {
        $_GET[$k] = addslashes($v);
    }
}
include "config.php";
include "language.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
while ($r = $db->fetch_row($settq)) {
    $set[$r['conf_name']] = $r['conf_value'];
}
if ($_POST['username'] == "" || $_POST['password'] == "") {
    die("<h3>{$set['game_name']} Error</h3>\r\n{$nofill}<br>\r\n<a href=login.php>&gt; Back</a>");
}
$uq = $db->query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')");
if ($db->num_rows($uq) == 0) {
    die("<h3>{$set['game_name']} Error</h3>\r\n{$invalid}<br>\r\n<a href=login.php>&gt; {$lerrortry}</a>");
} else {
    $_SESSION['loggedin'] = 1;
    $mem = $db->fetch_row($uq);
    $_SESSION['userid'] = $mem['userid'];
    $IP = $_SERVER['REMOTE_ADDR'];
    $IP = addslashes($IP);
    $IP = mysql_real_escape_string($IP);
开发者ID:Rizwan1738,项目名称:Mafia-Game-Script,代码行数:31,代码来源:authenticate.php

示例10: database

<?php

include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
include "global_func.php";
$fetch = $db->query("SELECT * FROM `battle_ladders` ORDER BY `ladderLevel` ASC");
while ($ft = $db->fetch_row($fetch)) {
    $count = 0;
    $sql = $db->query(sprintf("SELECT * FROM `battle_members` LEFT JOIN `users` ON `userid` = `bmemberUser` WHERE `bmemberLadder` = '%u' ORDER BY `bmemberScore` DESC LIMIT 10", $ft['ladderId']));
    while ($r = $db->fetch_row($sql)) {
        $count++;
        $cash = rand(500000, 750000) / 10 * $r['level'] / $count * ($ft['ladderLevel'] + 1);
        $points = rand(120, 250) / 10 * $r['level'] / $count * ($ft['ladderLevel'] + 1);
        if ($r['userid']) {
            $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `crystals` = `crystals` + '%d' WHERE `userid` = '%u'", $cash, $points, $r['bmemberUser']));
            event_add($r['bmemberUser'], 'You have earned $' . number_format($cash) . ' and ' . number_format($points) . ' Points for achieveing rank #' . $count . ' in the ' . $ft['ladderName'] . ' ladder!');
        }
    }
}
$db->query("TRUNCATE TABLE battle_members;");
print "\n\n<meta HTTP-EQUIV='REFRESH' content='5; url=staff.php?action=cmanual'>\n<style type='text/css'>\n.style2 {\n    text-align: center;\n}\n.style3 {\n    text-align: center;\n    color: #008000;\n}\n.style4 {\n    color: #FFFFFF;\n}\n</style>\n\n\n<body style='background-color: #000000'>\n\n<h2 class='style3'>Cron Job Successfully Ran</h2>\n\n<div class='style2'>\n    <h3>\n\n<a href='staff.php?action=cmanual'><span class='style4'>Back</span></a></h3>\n</div> \n\n";
开发者ID:Rizwan1738,项目名称:Mafia-Game-Script,代码行数:27,代码来源:battle_cron.php

示例11: get_all_messages_after_given_date

 public static function get_all_messages_after_given_date($game_id, $date)
 {
     if (safe_input::is_number($game_id) && safe_input::is_number_floating($date)) {
         $query = "SELECT * FROM `message` where `gameID` = '{$game_id}' AND `date` > '{$date}' ";
         $db = new database();
         $res = $db->query($query);
         if ($db->number_of_rows() < 1) {
             return null;
             //no results to return
         } else {
             $messages;
             while ($message = $db->fetch_row()) {
                 $messages[] = $message;
             }
             return $messages;
         }
     } else {
         return null;
         //invalid input
     }
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:21,代码来源:table_message.php

示例12: get_session_by_hash

 public static function get_session_by_hash($hash)
 {
     if (safe_input::is_valid_session_hash($hash)) {
         $safe_hash = safe_input::sql_inj($hash);
         $query = "SELECT * FROM `session` WHERE `hash` = '{$safe_hash}'";
         $db = new database();
         $db->query($query);
         if ($db->number_of_rows() > 0) {
             return $db->fetch_row();
         } else {
             return null;
         }
     } else {
         return null;
         //invalid hash
     }
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:17,代码来源:table_session.php

示例13: valid_email

<?php

require 'encryptor.php';
$crypt = new encryption_class();
include "config.php";
global $_CONFIG, $affID;
define("MONO_ON", 1);
require "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
while ($r = $db->fetch_row($settq)) {
    $set[$r['conf_name']] = $r['conf_value'];
}
$q2 = $db->query("SELECT totcash,top5earn,last5co,totusers FROM cashin");
$r = $db->fetch_row($q2);
function valid_email($email)
{
    // First, we check that there's one @ symbol, and that the lengths are right
    if (!ereg("^[^@]{1,64}@[^@]{1,255}\$", $email)) {
        // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
        return false;
    }
    // Split it into sections to make life easier
    $email_array = explode("@", $email);
    $local_array = explode(".", $email_array[0]);
    for ($i = 0; $i < sizeof($local_array); $i++) {
        if (!ereg("^(([A-Za-z0-9!#\$%&#038;'*+/=?^_`{|}~-][A-Za-z0-9!#\$%&#038;'*+/=?^_`{|}~\\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))\$", $local_array[$i])) {
开发者ID:marcfeather,项目名称:Multiplayer-PHP-Ajax-Games,代码行数:31,代码来源:register.php

示例14: getAllGamesForUserId

 public static function getAllGamesForUserId($user_id)
 {
     if (safe_input::is_number($user_id)) {
         $db = new database();
         $query = "SELECT * FROM `game` where `player1ID` = '{$user_id}' or `player2ID` = '{$user_id}' ";
         $db->query($query);
         if ($db->number_of_rows() == 0) {
             return null;
             //there are no games associated wiht this user id!
         } else {
             while ($game = $db->fetch_row()) {
                 $allGames[] = $game;
             }
             return $allGames;
         }
     } else {
         return -1;
         //ERROR
     }
 }
开发者ID:uunuu,项目名称:dot_boxes,代码行数:20,代码来源:table_game.php

示例15: database

<?php

include 'includes/config.php';
global $_CONFIG;
include_once 'includes/db.class.php';
$db = new database();
$db->configure($dbhost, $dbuser, $dbpass, $dbname, $dbpre);
$db->connect();
// $set = $db->fetch_row($db->query(sprintf('SELECT * FROM fas_settings')));
//ALTER TABLE dd_users ADD template VARCHAR(250) AFTER plays;
if (isset($_SESSION['userid'])) {
    $suserid = $_SESSION['userid'];
    $usrdata = $db->fetch_row($db->query(sprintf('SELECT * FROM fas_users WHERE userid=\'%u\'', $suserid)));
} else {
    $suserid = NULL;
    $usrdata = NULL;
}
if (isset($suserid)) {
    $query = mysql_query("SELECT `template` FROM `fas_users` WHERE `userid`='{$suserid}'");
    $row = mysql_fetch_array($query);
    $user_template = $row['template'];
} else {
    $user_template = '';
}
if (!empty($user_template) && $user_template != "default") {
    $template = $user_template;
} else {
    $query = mysql_query("SELECT `template` FROM `fas_themes` WHERE `default`='1'");
    $row = mysql_fetch_array($query);
    $template = $row['template'];
}
开发者ID:freearcadescript,项目名称:FreeArcadeScript,代码行数:31,代码来源:core.php


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