забыли параметр функции

This commit is contained in:
Igor Barkov (iwork)
2020-07-07 12:50:45 +03:00
parent 32cccc64cf
commit 6c6812f818
2 changed files with 35 additions and 15 deletions
+27 -8
View File
@@ -10,26 +10,45 @@ class DressedItems
protected $DB;
private $dressedItem;
public function __construct() {
// Пустой потому что нужны разные запросы.
public function __construct($user_id) {
$this->userid = $user_id ?? 0;
}
private function getDressedItems($user_id)
private function getDressedItems()
{
try {
return db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $user_id);
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->userid);
while ($row = $this->DB->fetch_assoc()) {
$dressed_item[$row['dressed_slot']] = $row;
$this->dressedItem[$row['dressed_slot']] = $row;
}
} catch (Exception $e) {
echo '<div class="debug">getDressedItems: ' . $e . '</div>';
}
return null;
}
public function getSlots($user_id)
public function getSlots()
{
while ($row = $this->getDressedItems($user_id)->fetch_assoc()) {
return $this->dressedItem;
}
private function runQuery($user_id)
{
try {
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $user_id);
} catch (Exception $e) {
echo '<div class="debug">getDressedItems: ' . $e . '</div>';
}
}
public function eeee($user_id)
{
if (!$this->DB) {
$this->runQuery($user_id);
}
while ($row = $this->DB->fetch_assoc()) {
$dressed_item[$row['dressed_slot']] = $row;
$this->dressedItem[$row['dressed_slot']] = $row;
}
return $this->dressedItem;
}
}