Оптимизация запросов в БД.

This commit is contained in:
lopar 2018-02-28 23:16:09 +02:00
parent fae934f0ad
commit 3e51461e6e
3 changed files with 97 additions and 92 deletions

View File

@ -1,7 +1,10 @@
<?php
include 'config.php';
include 'functions.php';
include '../config.php';
//include '../functions.php';
showinf_pers(10736,1);
//showinf_pers(10736,1);
showinf_pers(10736);
//showinf_pers(10736);
$row = db::c()->query('select * from `bank` WHERE owner=10929 OR owner=11221')->fetch_assoc_array();
print_r($row);

164
bank.php
View File

@ -184,88 +184,88 @@ if (!$_SESSION['bankid']) {
$user1 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='" . $user['id'] . "' LIMIT 1;"));
$svstats = $user1['sila'] + $user1['lovk'] + $user1['inta'] + $user1['vinos'] + $user1['intel'] + $user1['mudra'] - 12 - $user1['level'];
if ($svstats <= $bank['ekr']) {
$exps = array("20" => array(15),
"45" => array(16),
"75" => array(17),
"110" => array(18),
"160" => array(21),
"215" => array(22),
"280" => array(23),
"350" => array(24),
"410" => array(25),
"530" => array(28),
"670" => array(29),
"830" => array(30),
"950" => array(31),
"1100" => array(32),
"1300" => array(33),
"1450" => array(36),
"1650" => array(37),
"1850" => array(38),
"2050" => array(39),
"2200" => array(40),
"2500" => array(41),
"2900" => array(46),
"3350" => array(47),
"3800" => array(48),
"4200" => array(49),
"4600" => array(50),
"5000" => array(51),
"6000" => array(54),
"7000" => array(55),
"8000" => array(56),
"9000" => array(57),
"10000" => array(58),
"11000" => array(59),
"12000" => array(60),
"12500" => array(61),
"14000" => array(64),
"15500" => array(65),
"17000" => array(66),
"19000" => array(67),
"21000" => array(68),
"23000" => array(69),
"26000" => array(70),
"30000" => array(71),
"60000" => array(76),
"75000" => array(77),
"150000" => array(78),
"175000" => array(79),
"200000" => array(80),
"225000" => array(81),
"250000" => array(82),
"260000" => array(83),
"280000" => array(84),
"300000" => array(85),
"1500000" => array(86),
"1750000" => array(87),
"2000000" => array(88),
"2175000" => array(89),
"2300000" => array(90),
"2400000" => array(91),
"2500000" => array(92),
"2600000" => array(93),
"2800000" => array(94),
"3000000" => array(95),
"6000000" => array(96),
"6500000" => array(97),
"7500000" => array(98),
"8500000" => array(99),
"9000000" => array(100),
"9250000" => array(101),
"9500000" => array(102),
"9750000" => array(103),
"9900000" => array(104),
"10000000" => array(105),
"13000000" => array(106),
"14000000" => array(107),
"15000000" => array(108),
"16000000" => array(109),
"17000000" => array(110),
"17500000" => array(111),
"18000000" => array(112),
"19000000" => array(113),
"19500000" => array(114));
$exps = ["20" => [15],
"45" => [16],
"75" => [17],
"110" => [18],
"160" => [21],
"215" => [22],
"280" => [23],
"350" => [24],
"410" => [25],
"530" => [28],
"670" => [29],
"830" => [30],
"950" => [31],
"1100" => [32],
"1300" => [33],
"1450" => [36],
"1650" => [37],
"1850" => [38],
"2050" => [39],
"2200" => [40],
"2500" => [41],
"2900" => [46],
"3350" => [47],
"3800" => [48],
"4200" => [49],
"4600" => [50],
"5000" => [51],
"6000" => [54],
"7000" => [55],
"8000" => [56],
"9000" => [57],
"10000" => [58],
"11000" => [59],
"12000" => [60],
"12500" => [61],
"14000" => [64],
"15500" => [65],
"17000" => [66],
"19000" => [67],
"21000" => [68],
"23000" => [69],
"26000" => [70],
"30000" => [71],
"60000" => [76],
"75000" => [77],
"150000" => [78],
"175000" => [79],
"200000" => [80],
"225000" => [81],
"250000" => [82],
"260000" => [83],
"280000" => [84],
"300000" => [85],
"1500000" => [86],
"1750000" => [87],
"2000000" => [88],
"2175000" => [89],
"2300000" => [90],
"2400000" => [91],
"2500000" => [92],
"2600000" => [93],
"2800000" => [94],
"3000000" => [95],
"6000000" => [96],
"6500000" => [97],
"7500000" => [98],
"8500000" => [99],
"9000000" => [100],
"9250000" => [101],
"9500000" => [102],
"9750000" => [103],
"9900000" => [104],
"10000000" => [105],
"13000000" => [106],
"14000000" => [107],
"15000000" => [108],
"16000000" => [109],
"17000000" => [110],
"17500000" => [111],
"18000000" => [112],
"19000000" => [113],
"19500000" => [114]];
echo "<pre>";
$ss = mysql_query("SELECT `id`,`nextup`,`level` FROM `users` WHERE `level` > 0 AND `level` < 8 AND id='" . $user['id'] . "';");
$errdo = 0;

View File

@ -3834,6 +3834,7 @@ function show_item($row, $txt, $place)
function magicinf($id)
{
return mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '{$id}' LIMIT 1"));
return db::c()->query()->fetch_assoc_array()
}
/**
@ -3844,11 +3845,14 @@ function showpersinfo($id) {
}
// показать перса в инфе
/**
* Отображение персонажа в main.php
* @param $id
*/
function showpersinv($id)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1;"));
$dressed = array();
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
$dressed = [];
$r = mysql_query("SELECT * FROM `inventory` WHERE
`id` = '$user[helm]' OR `id` = '$user[weap]' OR `id` = '$user[plaw]' OR `id` = '$user[bron]' OR
`id` = '$user[rybax]' OR `id` = '$user[belt]' OR `id` = '$user[sergi]' OR `id` = '$user[kulon]' OR
@ -3866,7 +3870,7 @@ function showpersinv($id)
echo($user['align'] > 0 ? $user['align'] : "0"); ?>.gif">
<img src="i/klan/<? ClanImage($user['klan']); ?>.gif">;
<B><?= $user['login'] ?></B> [<?= $user['level'] ?>]
<a href=inf.php?<?= $user['id'] ?> target=_blank><IMG SRC=i/inf.gif WIDTH=12 HEIGHT=11
<a href=inf.php?<?= $user['login'] ?> target=_blank><IMG SRC=i/inf.gif WIDTH=12 HEIGHT=11
ALT="Инф. о <?= $user['login'] ?>"></a>
<TABLE cellspacing=0 cellpadding=0>
@ -4374,8 +4378,6 @@ function dropitemid($slot, $id)
$user[$slot1] = 0;
}
return true;
} else {
echo mysql_error();
}
}