-
Notifications
You must be signed in to change notification settings - Fork 1
/
refresh_cart.php
54 lines (28 loc) · 1.21 KB
/
refresh_cart.php
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
44
45
46
47
48
49
50
51
52
53
54
<?php
if(isset($_SESSION['u_name'])){
$us_name= $_SESSION['u_name'] ;
require_once "connect.php";
//UPDATE CART PRICE, 30-03-2018, Prabhat Chandra
$sql = $conn->query("SELECT p_id, user_name, SUM(u_price) AS t_price
FROM u_cart
GROUP BY user_name = '$us_name' ;")
or die(mysqli_error($conn)) ;
while($min = $sql->fetch_array()){
$id = $min['p_id'];
$cus_name = $min['user_name'];
$totalprice = $min['t_price'];
$conn->query("REPLACE INTO `cart_t` VALUES( '$cus_name', '$totalprice' )") or die(mysqli_error($conn));
}
//Cart QUANTITY Calculation, Created on 30-03-2018, Prabhat Chandra
$sql = $conn->query("SELECT user_name, SUM(u_qty) AS tt_qty
FROM u_cart
GROUP BY user_name = '$us_name'
;")
or die(mysqli_error($conn)) ;
while($tq = $sql->fetch_array()){
$totalqty = $tq['tt_qty'];
//echo $totalqty;
$conn->query("REPLACE INTO `cart_t_q` VALUES( '$us_name', '$totalqty' )") or die(mysqli_error($conn));
}
}
?>