本文整理汇总了PHP中mysql_fetch_Array函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_fetch_Array函数的具体用法?PHP mysql_fetch_Array怎么用?PHP mysql_fetch_Array使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_fetch_Array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MySQL_get_array
function MySQL_get_array($Table, $Collumn, $Condition)
{
$Query = "SELECT " . $Collumn . " FROM `" . $Table . "`";
if (isset($Condition)) {
$Query = $Query . " WHERE " . $Condition;
}
$Data = mysql_Query($Query) or die(mysql_error());
$Array = mysql_fetch_Array($Data);
return $Array;
}
示例2: mysql_fetch_array
<table cellspacing=0 cellpadding=0 border=0 width="100%">
<tr>
<td background="img/design/left-bgr-blank.gif"><img src="img/design/dot.gif" width=10 height=1 hspace=0 vspace=0 border=0></td>
<td width=100% background="img/design/bgr.jpg">
<?php
$db = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE login='" . $login . "'"));
if ($db) {
echo "\n\t\t\t\t\t<br/><br/><br/>\n\t\t\t\t\t<h3>Покупка Платины (Пл.) Оплата со счета мобильного телефона.</h3>\n\t\t\t\t\t<center>Оплата за покупку будет списана с баланса счета Вашего мобильного телефона.<br>";
if ($bonus) {
echo "<font color=red>Внимание! Акция! При покупке Платины - в подарок дополнительно <b>" . $bonus . "%</b> от суммы покупки!</font><br><br>";
}
echo "<br><br>";
##===========================================================
if ($_POST["bankid"]) {
$bank_id = (int) $_POST["bankid"];
$have_bank_id = mysql_fetch_Array(mysql_query("SELECT number FROM bank WHERE login='" . $login . "' and number=" . $bank_id));
if ($have_bank_id) {
$_SESSION["bank_id"] = $bank_id;
switch ($_POST["amount"]) {
case 1:
$_SESSION["amount"] = 0.1;
break;
case 2:
$_SESSION["amount"] = 2;
break;
case 5:
$_SESSION["amount"] = 5;
break;
default:
$_SESSION["amount"] = 2;
break;
示例3: mysql_Query
?>
</font>
<h4>Статистика</h4>
• Побед в Башне Смерти: <B><?php
echo $res[0];
?>
</B><BR>
• Рейтинг в Башне Смерти: <B><?php
echo $reputation;
?>
</B><BR>
• Репутация в Башне Смерти: <B><?php
echo $db["reputation"];
?>
</B><BR>
<h4>Задания в Башне</h4>
1. <a href="?zad=1">Выиграть поединок в Башне Смерти</a> <i>(5 репутации, 50.00 Зл.)</i><BR>
2. <a href="?zad=2">Выиграть Башню Смерти</a> <i>(100 репутации, 1000.00 Ед.)</i><BR>
<BR><BR>
<h4>Последний 10 Рыцарей Башни Смерти</h4>
<?php
$sql = mysql_Query("SELECT users.login,users.level,users.id,users.orden,users.admin_level,users.clan,users.clan_short,users.dealer FROM `inv` LEFT JOIN users on users.login=inv.owner WHERE `object_id`=31 and `object_type`='medal' ORDER BY inv.date ASC");
while ($dat = mysql_fetch_Array($sql)) {
echo "<script>drwfl('" . $dat['login'] . "','" . $dat['id'] . "','" . $dat['level'] . "','" . $dat['dealer'] . "','" . $dat['orden'] . "','" . $dat['admin_level'] . "','" . $dat['clan_short'] . "','" . $dat['clan'] . "');</script><br>";
}
?>
</BODY>
</HTML>
示例4: date
}
if ($total < $start + $ttt) {
$end = $total;
} else {
$end = $start + $ttt;
}
for ($i = 0; $i < $total; $i++) {
$classdate = "date";
#$time =date("d.m.y H:i",$chat_array[$i][1]);
$time = date("H:i", $chat_array[$i][1]);
$name = $chat_array[$i][2];
$color = $chat_array[$i][3];
$body = $chat_array[$i][4];
$msg_room = $chat_array[$i][5];
$msg_city = $chat_array[$i][6];
$have_ignor = mysql_fetch_Array(mysql_Query("SELECT count(*) FROM ignor WHERE login='" . $login . "' and ignored='" . $name . "'"));
if (eregi("to \\[{$login}\\]", $body, $regs)) {
$classdate = "date2";
$forom = 1;
}
if (eregi("private \\[{$login}\\]", $body, $regs)) {
$classdate = "date2";
}
if (eregi("clan \\[{$my_clan}\\]", $body, $regs)) {
$classdate = "date2";
}
if (substr($body, 0, 7) == "private") {
if (eregi("private \\[{$login}\\]", $body, $regs)) {
if (!$have_ignor[0]) {
$massages .= "<font class='{$classdate}'>{$time}</font> [<a href='?who={$name}'>{$name}</a>] <font color='{$color}'>{$body}</font> <br/>";
}
示例5: mysql_fetch_Array
$res = mysql_fetch_Array(mysql_query("SELECT users.login,id,level,users.remote_ip FROM online LEFT JOIN users on users.login=online.login WHERE users.battle=0 and zayavka=0 and online.room='room4' and level>=9 ORDER BY level DESC LIMIT 1"));
if ($res) {
$prototype = "Исчадие Хаоса";
mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','23','3','" . $res["id"] . "')");
mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over,leader) VALUES('" . $res["login"] . "','1','" . $res["remote_ip"] . "','" . $res["id"] . "','0','0','1')");
addBot($res["login"], $res["id"], $prototype, $prototype);
goBattle($res["login"]);
say("toall_news", "<font color=\"#ff0000\">Объявления:</font> <font color=darkblue><b>Началась Битва между " . $res["login"] . " и Исчадием Хаоса</b></font>", $res["login"]);
echo "OK";
} else {
echo "NO USERS";
}
}
}
if ($_POST["heal"]) {
$query = mysql_fetch_Array(mysql_query("SELECT * FROM zayavka WHERE type=23"));
if ($query) {
$res = mysql_fetch_array(mysql_Query("SELECT * FROM battles WHERE creator_id=" . $query["creator"]));
$have_bot = mysql_fetch_array(mysql_Query("SELECT * FROM bot_temp WHERE battle_id=" . $res["id"] . " and team=2"));
$hp_add = 50000;
$new_hp = $have_bot["hp"] + $hp_add;
if ($new_hp > $have_bot["hp_all"]) {
$new_hp = $have_bot["hp_all"];
$hp_add = $have_bot["hp_all"] - $have_bot["hp"];
}
mysql_Query("UPDATE bot_temp SET hp=hp+{$hp_add} WHERE id=" . $have_bot["id"]);
$phrase_priem = "<span class=date>" . date("H:i") . "</span> <b>Исчадие Хаоса</b> понял что его спасение это прием <b>Воля к победе. <font color=green>+{$hp_add}</font></b> [" . $new_hp . "/" . $have_bot['hp_all'] . "]<br>";
battle_log($res["id"], $phrase_priem);
} else {
echo "You Should Start Battle";
}
示例6: htmlspecialchars
<?php
$priem = htmlspecialchars(addslashes($_GET['special']));
if ($db["battle_team"] == 1) {
$span = "p1";
} else {
$span = "p2";
}
$priems = mysql_fetch_array(mysql_query("SELECT * FROM battle_units WHERE player='" . $login . "' and battle_id='" . $bid . "'"));
$is_pr = mysql_fetch_Array(mysql_query("SELECT * FROM person_on LEFT JOIN priem ON priem.type=pr_name WHERE pr_name = '" . $priem . "' and id_person=" . $db["id"] . " and battle_id='" . $bid . "'"));
if ($is_pr) {
$enable = true;
$can_use = checkbattlehars((int) $is_pr["hit"], (int) $is_pr["krit"], (int) $is_pr["block"], (int) $is_pr["uvarot"], (int) $is_pr["hp"], (int) $is_pr["all_hit"], (int) $is_pr["parry"], (int) $priems["hit"], (int) $priems["krit"], (int) $priems["block"], (int) $priems["uvarot"], (int) $priems["hp"], (int) $priems["counter"], (int) $priems["parry"]);
if ($can_use) {
if ($is_pr["pr_cur_uses"] > 0) {
if ($is_pr["pr_wait_for"]) {
if ($is_pr['pr_wait_for'] > 0) {
$enable = false;
echo "<b style='color:red'>Нельзя использовать: еще идет задержка </b>";
}
if ($is_pr['pr_active'] != 1 && $is_pr["pr_cur_uses"] <= 1) {
$enable = false;
echo "<b style='color:red'>Нельзя использовать: активен</b>";
}
} else {
if ($is_pr['pr_active'] != 1 && $is_pr["pr_cur_uses"] <= 1) {
$enable = false;
echo "<b style='color:red'>Нельзя использовать: уже активен</b>";
}
}
} else {
示例7: mysql_connect
<?php
include "conf.php";
$data = mysql_connect($base_name, $base_user, $base_pass);
mysql_select_db($db_name, $data);
$row = mysql_query("select inv.id from users left join inv on inv.owner=users.login where users.orden=1 and inv.object_type='scroll' and inv.object_id=60");
while ($res = mysql_fetch_Array($row)) {
mysql_query("UPDATE inv SET iznos_max=121 WHERE id=" . $res[0]);
}
示例8: AA_heats_changePosition
/**
* change heat
* ---------------------------------
*/
function AA_heats_changePosition($round)
{
require './lib/common.lib.php';
include './config.inc.php';
if (empty($_POST['pos']) && empty($_POST['track'])) {
AA_printErrorMsg($GLOBALS['strErrEmptyFields']);
} else {
mysql_query("LOCK TABLES runde READ, serie WRITE, serienstart WRITE, wettkampf READ, disziplin READ, meeting READ");
// change request by text field
if (empty($_POST['heat'])) {
$result = mysql_query("\r\n\t\t\t\tSELECT xSerie FROM \r\n\t\t\t\t\tserie \r\n\t\t\t\tWHERE\tBezeichnung = '" . $_POST['heatname'] . "'\r\n\t\t\t\tAND\txRunde = {$round}");
if (mysql_errno() > 0) {
AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
} else {
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
$_POST['heat'] = $row[0];
mysql_free_result($result);
}
}
}
$xSerie = 0;
// heat does not yet exist
if (AA_checkReference("serie", "xSerie", $_POST['heat']) == 0) {
// check if round still valid
if (AA_checkReference("runde", "xRunde", $round) != 0) {
// get discipline type for evaluating if a filmnumber is needed
$filmnr = 0;
$res_dist = mysql_query("SELECT disziplin.Typ FROM \r\n\t\t\t\t\t\t\t\trunde\r\n\t\t\t\t\t\t\t\tLEFT JOIN wettkampf USING(xWettkampf)\r\n\t\t\t\t\t\t\t\tLEFT JOIN disziplin USING(xDisziplin)\r\n\t\t\t\t\t\t\tWHERE runde.xRunde = {$round}");
if (mysql_errno() > 0) {
AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
} else {
$row_dist = mysql_fetch_Array($res_dist);
if ($row_dist[0] == $cfgDisciplineType[$strDiscTypeTrack] || $row_dist[0] == $cfgDisciplineType[$strDiscTypeTrackNoWind] || $row_dist[0] == $cfgDisciplineType[$strDiscTypeRelay] || $row_dist[0] == $cfgDisciplineType[$strDiscTypeDistance]) {
$filmnr = AA_heats_getNextFilm();
}
}
mysql_query("INSERT INTO serie SET" . " Bezeichnung = '" . $_POST['heatname'] . "'" . ", xRunde = {$round}" . ", xAnlage = 0\r\n\t\t\t\t\t\t\t , Film = {$filmnr}" . ", MaxAthlet = " . $cfgMaxAthlete);
if (mysql_errno() > 0) {
AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
} else {
$xSerie = mysql_insert_id();
// get new heat ID
}
}
} else {
$xSerie = $_POST['heat'];
}
if ($xSerie != 0) {
if (!empty($_POST['track'])) {
mysql_query("UPDATE serienstart SET" . " xSerie = " . $xSerie . ", Bahn = " . $_POST['track'] . " WHERE xSerienstart = " . $_POST['item']);
} else {
// update heat start with new heat / position
mysql_query("UPDATE serienstart SET" . " Position = '" . $_POST['pos'] . "', xSerie = " . $xSerie . ", Bahn = " . $_POST['pos'] . " WHERE xSerienstart = " . $_POST['item']);
}
if (mysql_errno() > 0) {
AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
}
}
AA_heats_deleteHeats();
mysql_query("UNLOCK TABLES");
// reset round status
if (AA_getRoundStatus($round) >= $GLOBALS['cfgRoundStatus']['heats_done']) {
AA_utils_changeRoundStatus($round, $GLOBALS['cfgRoundStatus']['heats_in_progress']);
if (!empty($GLOBALS['AA_ERROR'])) {
AA_printErrorMsg($GLOBALS['AA_ERROR']);
}
}
}
}
示例9: mysql_query
$q = mysql_query("SELECT * FROM users WHERE login='" . $target . "'");
$res = mysql_fetch_array($q);
if (!$res) {
echo "Персонаж <B>" . $target . "</B> не найден в базе данных.";
} else {
$sql_teams = mysql_fetch_Array(mysql_query("SELECT * FROM zayavka_teams WHERE player='" . $res["login"] . "'"));
if ($sql_teams) {
$sql_teams_p = mysql_query("SELECT * FROM zayavka_teams WHERE battle_id=" . $sql_teams["battle_id"]);
while ($result = mysql_fetch_array($sql_teams_p)) {
mysql_query("UPDATE users SET zayava=0 WHERE login='" . $result["player"] . "'");
}
mysql_query("DELETE FROM zayavka_teams WHERE battle_id=" . $sql_teams["battle_id"]);
mysql_query("DELETE FROM zayavka_bot WHERE id=" . $sql_teams["battle_id"]);
echo "OK-Спуск в Катакомбы";
} else {
$sql_teams = mysql_fetch_Array(mysql_query("SELECT * FROM z_login WHERE player='" . $res["login"] . "'"));
if ($sql_teams) {
$sql_teams_p = mysql_query("SELECT * FROM z_login WHERE group_id=" . $sql_teams["group_id"]);
while ($result = mysql_fetch_array($sql_teams_p)) {
mysql_query("UPDATE users SET zayava=0 WHERE login='" . $result["player"] . "'");
}
mysql_query("DELETE FROM z_login WHERE group_id=" . $sql_teams["group_id"]);
mysql_query("DELETE FROM z_group WHERE id=" . $sql_teams["group_id"]);
echo "OK-Вход в Клад";
} else {
mysql_query("UPDATE users SET zayava=0 WHERE login='" . $res["login"] . "'");
echo "OK";
}
}
}
}
示例10: session_start
<?php
session_start();
ob_start("@ob_gzhandler");
include "conf.php";
$login = $_SESSION["login"];
Header("Cache-Control: no-cache, must-revalidate");
// говорим браузеру что-бы он не кешировал эту страницу
Header("Pragma: no-cache");
$data = mysql_connect($base_name, $base_user, $base_pass) or die('Не получается подключиться. Проверьте имя сервера, имя пользователя и пароль!');
mysql_select_db($db_name) or die('Ошибка входа в базу данных');
$my_info = mysql_fetch_Array(mysql_query("SELECT admin_level FROM users WHERE login='" . $login . "'"));
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="ru">
<meta http-equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<meta http-equiv=Expires content=0>
<LINK rel="stylesheet" type="text/css" href="main.css">
</head>
<body bgcolor="#faeede">
<script language="JavaScript" type="text/javascript" src="commoninf.js"></script>
<?php
$clan = htmlspecialchars(addslashes($_GET['clan']));
if (empty($clan)) {
echo "Неверный запрос.";
} else {
$sql = mysql_query("SELECT clan.*,clan.level as c_level,users.login,users.id,users.level,users.dealer,users.orden,users.admin_level,users.clan_short,users.clan FROM clan LEFT JOIN users on users.id=clan.creator WHERE name_short='" . $clan . "'");
示例11: mysql_query
}
if ($perf == NULL) {
// invalid performance
$perf = 0;
}
mysql_query("\r\n\t\t\t\t\t\t\t\t\t\t\t\tINSERT INTO start SET \r\n\t\t\t\t\t\t\t\t\t\t\t\t\txWettkampf = " . $_POST['event'] . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t, xStaffel = {$xStaffel}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t, Bestleistung = {$perf}\r\n\t\t\t\t\t\t\t\t\t\t\t\t");
if (mysql_errno() > 0) {
AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
} else {
// get each round for this event
$xRounds = array();
$res_rnd = mysql_query("SELECT xRunde FROM runde WHERE xWettkampf = " . $_POST['event']);
if (mysql_errno() > 0) {
AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
} else {
while ($row_rnd = mysql_fetch_Array($res_rnd)) {
$xRounds[] = $row_rnd[0];
}
}
if (count($xRounds) == 0) {
AA_printErrorMsg($strRelayDefineRounds);
}
$xStart = mysql_insert_id();
// get new ID
$c = 0;
if ($_POST['starts'] > 0) {
foreach ($_POST['starts'] as $start) {
foreach ($xRounds as $xRound) {
if ($_POST['positions'][$c] > 0) {
mysql_query("\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINSERT INTO staffelathlet\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\txStaffelstart = {$xStart}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, xAthletenstart = {$start}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, Position='" . $_POST['positions'][$c] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, xRunde = '{$xRound}'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
}
示例12: sum_betto
function sum_betto($num)
{
$sum_s = mysql_fetch_Array(mysql_query("SELECT count(*) FROM roul_bets WHERE betto={$num}"));
return $sum_s[0];
}
示例13: setMN
$mn_add = $db["mana_all"] - $db["mana"];
}
setMN($login, $new_mn, $db['mana_all']);
}
##################################################
if ($db["battle_team"] == 1) {
$span = "p1";
} else {
$span = "p2";
}
$phrase_hell = "<span class=date>" . $date . "</span> <span class={$span}>" . $login . "</span>, нетрезво оценив положение, решил, что поможет ему только прием <b>Передышка</b> <font color=green><b>+{$hp_add} HP</b></font> [" . $new_hp . "/" . $db['hp_all'] . "] " . ($mn_add > 0 ? "<font color=blue><b>+{$mn_add} MN</b></font> [" . $new_mn . "/" . $db['mana_all'] . "]" : "") . ".<br>";
battle_log($bid, $phrase_hell);
##################################################
$names = array("Бармаглот", "Пещерный-Ящер", "Повелитель-Бармаглотов", "Угрюмый-Дендроид", "Мерцающий-феникс", "Сумрачный-Грифон", "Ядерник", "Радскорпион", "Дикий гул", "Леврета", "Линграонц", "Падший король");
$names_unikal = array("Темный Линграонц", "Темный Леврета", "Лютый Линграонц", "Лютый Леврета", "Коварная Смотрительница", "Жадный Смотритель", "Осквернитель Хаоса");
$bot_count = mysql_fetch_Array(mysql_Query("SELECT count(*) FROM `bot_temp` WHERE `battle_id`={$bid} and team=2"));
if ($have_hell["unikal"] == 5) {
$bot_u = array();
if ($db["level"] == 8) {
$bot_u[0] = $names_unikal[0];
$bot_u[1] = $names_unikal[1];
} else {
if ($db["level"] == 9) {
$bot_u[0] = $names_unikal[2];
$bot_u[1] = $names_unikal[3];
} else {
if ($db["level"] >= 10) {
$bot_u[0] = $names_unikal[4];
$bot_u[1] = $names_unikal[5];
$bot_u[2] = $names_unikal[6];
}
示例14: prodaja
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/magic-main.js"></SCRIPT>
<script>
function prodaja(id,name)
{
if(confirm('Вы уверены что хотите продать предмет '+name+' ?'))
{
location.href = '?otdel=12&sell_id='+id+'&name='+name;
}
}
</script>
<div id=hint4></div>
<?php
if ($_GET["sell_id"]) {
$item_id = (int) $_GET['sell_id'];
$item_sell = mysql_fetch_Array(mysql_query("SELECT scroll.price, scroll.name, scroll.art, inv.id, inv.iznos, inv.iznos_max, inv.gift, inv.gift_author,inv.podzemka FROM inv LEFT JOIN scroll on scroll.id=inv.object_id WHERE inv.owner='" . $login . "' and inv.id={$item_id} and inv.wear=0"));
if (!$item_sell) {
$msg = "Вещь не найдена";
} else {
$pal_price = round(0.75 * $item_sell["price"]);
$m_type = "money";
$money_type = "Зл.";
if ($item_sell["art"]) {
$m_type = "platina";
$money_type = "Пл.";
}
$price = $pal_price * ($item_sell["iznos_max"] - $item_sell["iznos"]) / $item_sell["iznos_max"];
$price = round($price, 2);
if ($price < 0) {
$price = 0;
}
示例15: mysql_query
<tr>
<td align=center>
<TABLE WIDTH=100% CELLSPACING=1 CELLPADDING=2 BGCOLOR=#CEBBAA>';
if ($_GET['otdel'] == "obj") {
$seek = mysql_query("SELECT * FROM paltar WHERE id in {$item_Array_str} ORDER BY min_level ASC,price ASC");
while ($res = mysql_fetch_array($seek)) {
$n = !$n;
$str = '';
echo '
<tr class="' . ($n ? 'l0' : 'l1') . '">
<td valign=center align=center width=300 nowrap>
<img src="img/items/' . $res['img'] . '"><br>
<a href="?buy=' . $res["id"] . '">Купить</a><br><br><br><b>Требуется</b><br>';
if (count($item_array[$res["id"]])) {
foreach ($item_array[$res["id"]] as $currentValues) {
$query = mysql_fetch_Array(mysql_query("SELECT img FROM wood WHERE id=" . $currentValues["item"]));
$str .= "<span style=\"position:relative; width:60px; height:60px;\"><img src=img/" . $query["img"] . "><small style='background-color: #E0E0E0; position: absolute; right: 1; bottom: 1;'><B>" . $currentValues["count"] . " шт.</B></small></span> ";
}
echo $str;
}
echo '
</td>
<td width=100%>';
show_item($db, $res);
echo '</td>
</tr>';
}
if (!mysql_num_rows($seek)) {
echo "<tr bgcolor='#C7C7C7'><td valign=center align=center nowrap colspan=2><b>Прилавок магазина пустой...</b></td></tr>";
}
} else {