Functia arata cam asa :
Cod: Selectaţi tot
function total_produse(){
if(isset($_GET['add_cart'])){
global $handeler;
$ip = getIp();
$get_items = "SELECT * from cart where ip_add='$ip'";
$run_items = $handeler->query($get_items);
$count_items = $run_items->fetch(PDO::FETCH_ASSOC);
}
else{
global $handeler;
$ip = getIp();
$get_items = "SELECT * from cart where ip_add='$ip'";
$run_items = $handeler->query($get_items);
$count_items = $run_items->fetch(PDO::FETCH_ASSOC);
}
echo $count_items;
}