prepare($sql); $stmt->execute(); $topCustomer = $stmt->fetch(); } catch (Throwable $e) { $queryError = $e->getMessage(); } } ?>
Tính tổng số lượng sản phẩm đã mua bằng SUM(oi.quantity), sắp xếp giảm dần ORDER BY total_quantity_bought DESC và giới hạn LIMIT 1.
= htmlspecialchars($sql) ?>
Email: = htmlspecialchars($topCustomer['email']) ?>
Điện thoại: = htmlspecialchars($topCustomer['phone'] ?? '') ?>
Địa chỉ: = htmlspecialchars($topCustomer['address'] ?? '') ?>