File "get_bill.php"

Full Path: /home/magicrsz/public_html/actions/get_bill.php
File size: 656 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
session_start();

include "../admin/database.php" ;


$user_id=NULL;

if(isset($_SESSION['user_email'])){

    $user_id=$_SESSION['user_email'];
}
else
{
    $user_id=session_id();
}


$query="SELECT * from temp_cart where user_id='$user_id'";
$rec=db::getRecords($query);
$price=NULL;
if($rec!=null)
{
foreach($rec as $rec2)
     {
    
    $product_id=$rec2['product_id'];
    $query="SELECT * from product where id='$product_id'";
    $product=db::getRecord($query);
    
    $product_price = $rec2['total'];
     
    $price=$price + $product_price;
   
};

echo "$".$price;
}else{

    echo "$0";
}
 
?>