%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/medipszd/www/
Upload File :
Create Path :
Current File : //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);
	}
?>

Zerion Mini Shell 1.0