class errors

This commit is contained in:
Igor Barkov (iwork) 2020-07-20 17:22:51 +03:00
parent b6640ae32f
commit d3a0465f9a

View File

@ -7,9 +7,9 @@
class DressedItems
{
protected $DB;
protected static $DB;
protected $DBSUM;
protected $USERID;
protected static $USERID;
private $dressedItem;
/**
@ -19,13 +19,14 @@ class DressedItems
*/
public function __construct($user_id)
{
$this->USERID = $user_id;
//$this->USERID = $user_id;
self::$USERID = $user_id;
}
private function getDressedItems()
private static function getDressedItems()
{
try {
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->USERID);
self::$DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', self::$USERID);
} catch (Exception $e) {
echo '<div class="debug">Не прогрузилась таблица inventory (*) для класса DressedItems.</div>';
}
@ -48,7 +49,7 @@ SELECT SUM(add_strength) as sum_strength,
SUM(add_max_physical_damage) as sum_max_phys_damage
FROM inventory WHERE owner_id = ?i AND dressed_slot > 0
SQL;
$this->DBSUM = db::c()->query($query, $this->USERID)->fetch_assoc();
$this->DBSUM = db::c()->query($query, self::$USERID)->fetch_assoc();
} catch (Exception $e) {
echo '<div class="debug">Не прогрузилась таблица inventory (SUM) для класса DressedItems:' . $e . '</div>';
}
@ -56,11 +57,11 @@ SQL;
public function getItemsInSlots()
{
if (!$this->DB) {
if (!self::$DB) {
//$this->getDressedItems();
self::getDressedItems();
}
while ($row = $this->DB->fetch_assoc()) {
while ($row = self::$DB->fetch_assoc()) {
$dressed_item[$row['dressed_slot']] = $row;
$this->dressedItem[$row['dressed_slot']] = $row;
}