prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); // FETCH ALL ORDERS (History) // Hum Orders table ko Products table se join kar rahe hain taaki product ka naam aur image dikhe $sql = "SELECT o.*, p.title, p.image FROM orders o JOIN products p ON o.product_id = p.id WHERE o.user_id = ? ORDER BY o.id DESC"; // Latest order pehle dikhega $stmt = $pdo->prepare($sql); $stmt->execute([$user_id]); $order_history = $stmt->fetchAll(); ?>
| Order Details | Amount | Transaction ID | Date | Status |
|---|---|---|---|---|
= htmlspecialchars($order['title']) ?>
ID: #= $order['id'] ?>
|
₹= number_format($order['amount']) ?> | = !empty($order['transaction_id']) ? $order['transaction_id'] : 'N/A' ?> |
= date('d M Y', strtotime($order['created_at'])) ?>
= date('h:i A', strtotime($order['created_at'])) ?> |
Paid Failed |