-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupcart.php
More file actions
43 lines (36 loc) · 1.11 KB
/
Copy pathupcart.php
File metadata and controls
43 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
include 'inc/session.php';
// $up = mysqli_query($connect, "SELECT SUM(quantity) AS quantity FROM cart WHERE level = 1");
// while ($row = mysqli_fetch_array($up)) {
// echo $row['quantity'];
// }
?>
<?php
if (isset($_SESSION['id'])) {
$cart = mysqli_query($connect, "SELECT SUM(quantity) AS quantity FROM cart WHERE user = '{$_SESSION['id']}' && status = 1");
while ($rows = mysqli_fetch_array($cart)) {
if ($rows['quantity'] != "") {
# code...
echo "(".$rows['quantity']. " items)";
}
else{
echo "(0 item)";
}
}
}elseif (isset($_SESSION['identity']) && !isset($_SESSION['id'])) {
$date = date('d/M/Y');
$cart = mysqli_query($connect, "SELECT SUM(quantity) AS quantity FROM guestcart WHERE user = '{$_SESSION['identity']}' && status = 1 && date = '{$date}'");
while ($rows = mysqli_fetch_array($cart)) {
if ($rows['quantity'] != "") {
# code...
echo "(".$rows['quantity']. " items)";
}
else{
echo "(0 item)";
}
}
}
else{
echo 0;
}
?>