fixed multiple database queries
This commit is contained in:
parent
af1b3ec361
commit
3c129870fe
@ -10,6 +10,11 @@ class nick
|
||||
private $invis;
|
||||
private $user_data;
|
||||
|
||||
/**
|
||||
* nick constructor.
|
||||
* @param $playerId
|
||||
* @param int $showInvisibility
|
||||
*/
|
||||
public function __construct($playerId, $showInvisibility = 1) {
|
||||
if (!$this->user_data) {
|
||||
$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
|
||||
{
|
||||
private $id;
|
||||
private $user_id;
|
||||
|
||||
|
||||
/**
|
||||
* u constructor.
|
||||
@ -15,14 +16,18 @@ class u
|
||||
*/
|
||||
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()
|
||||
{
|
||||
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