<?php
require_once 'config.php';

//include '../functions.php';
//showinf_pers(10736,1);
//showinf_pers(10736);

//// Получить все...
//$items = [];
//$res = db::c()->query('SELECT name,img,type,id FROM inventory WHERE owner = 11263 AND dressed = 1');
//foreach ($res->fetch_assoc() as $value) {
//    $items[$value[0]] = $value;
//}
//print_r($items);
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}

$iteminfo =[];
$result = db::c()->query('SELECT `shop`.*,
       `magic`.`name` AS `magic_name`,
       `magic`.`chanse` AS `magic_chanse`,
       `magic`.`time` AS `magic_time`,
       `magic`.`file` AS `magic_file`,
       `magic`.`targeted` AS `magic_targeted`,
       `magic`.`needcharge` AS `magic_needcharge`,
       `magic`.`img` AS `magic_img`

FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25');
$result2 = db::c()->query('SELECT `inventory`.*,
       `magic`.`name` AS `magic_name`,
       `magic`.`chanse` AS `magic_chanse`,
       `magic`.`time` AS `magic_time`,
       `magic`.`file` AS `magic_file`,
       `magic`.`targeted` AS `magic_targeted`,
       `magic`.`needcharge` AS `magic_needcharge`,
       `magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE owner = 11263');
while ($row = $result->fetch_assoc()) {
    $iteminfo[] = new ShopItem($row);
}

while ($row = $result2->fetch_assoc()) {
    $iteminfo[] = new InventoryItem($row);
}

echo "<table width='100%'>";
foreach ($iteminfo as $ii) {
    echo "<tr><td bgcolor='#d3d3d3'>";
    $ii->printImage();
    $ii->printControls();
    echo "</td>";
    echo "<td bgcolor='#d3d3d3'>";
    $ii->printInfo();
    echo "</td></tr>";
}
echo "</table>";