38471-vm/debug_items.php
Flatlogic Bot 8a346582bb items back
2026-02-21 18:11:55 +00:00

18 lines
790 B
PHP

<?php
require_once 'db/config.php';
$whereSql = "1=1";
$params = [];
$stmt = db()->prepare("SELECT i.*, c.name_en as cat_en, c.name_ar as cat_ar, u.short_name_en as unit_en, u.short_name_ar as unit_ar, s.name as supplier_name
FROM stock_items i
LEFT JOIN stock_categories c ON i.category_id = c.id
LEFT JOIN stock_units u ON i.unit_id = u.id
LEFT JOIN suppliers s ON i.supplier_id = s.id
WHERE $whereSql
ORDER BY i.id DESC");
$stmt->execute($params);
$items = $stmt->fetchAll();
echo "Count: " . count($items) . "\n";
foreach ($items as $item) {
echo "ID: {$item['id']}, Name: {$item['name_en']}\n";
}