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

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
+8 -6
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();
}
}