fixed multiple database queries
This commit is contained in:
parent
af1b3ec361
commit
3c129870fe
@ -10,6 +10,11 @@ class nick
|
|||||||
private $invis;
|
private $invis;
|
||||||
private $user_data;
|
private $user_data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nick constructor.
|
||||||
|
* @param $playerId
|
||||||
|
* @param int $showInvisibility
|
||||||
|
*/
|
||||||
public function __construct($playerId, $showInvisibility = 1) {
|
public function __construct($playerId, $showInvisibility = 1) {
|
||||||
if (!$this->user_data) {
|
if (!$this->user_data) {
|
||||||
$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$playerId)->fetch_assoc();
|
$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$playerId)->fetch_assoc();
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
class u
|
class u
|
||||||
{
|
{
|
||||||
private $id;
|
private $user_id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* u constructor.
|
* u constructor.
|
||||||
@ -15,14 +16,18 @@ class u
|
|||||||
*/
|
*/
|
||||||
public function __construct($playerId)
|
public function __construct($playerId)
|
||||||
{
|
{
|
||||||
$this->id = $playerId;
|
if (!$this->user_id) {
|
||||||
|
$this->user_id = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i',$playerId)->fetch_assoc();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function i()
|
public function i()
|
||||||
{
|
{
|
||||||
return db::c()->query('SELECT * FROM `users` WHERE `id` = ?i',$this->id)->fetch_assoc();
|
return $this->user_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user