%PDF- %PDF-
Direktori : /proc/thread-self/root/proc/self/root/home/medipszd/www/ |
Current File : //proc/thread-self/root/proc/self/root/home/medipszd/www/cart_total.php |
<?php include 'includes/session.php'; if(isset($_SESSION['user'])){ $conn = $pdo->open(); $stmt = $conn->prepare("SELECT * FROM cart LEFT JOIN products on products.id=cart.product_id WHERE user_id=:user_id"); $stmt->execute(['user_id'=>$user['id']]); $total = 0; foreach($stmt as $row){ $subtotal = $row['price'] * $row['quantity']; $total += $subtotal; } $pdo->close(); echo json_encode($total); } ?>