/
cart.php
63 lines (50 loc) · 1.33 KB
/
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
55
56
57
58
59
60
61
62
<?php
include "assets/variables.php";
include "assets/authenticate.php";
$dbh = new PDO("sqlite:".$database_url);
$login_name =$_COOKIE['username'];
$sql = "SELECT * "
."FROM Sellers "
."WHERE login_name='$login_name' LIMIT 1";
$user_seller = $dbh->query($sql);
$this_user_seller = $user_seller->fetch(PDO::FETCH_ASSOC);
$seller_id = $this_user_seller["seller_id"];
$sql2 = "SELECT * "
."From ("
."SELECT * "
."FROM ShoppingCarts "
."where user_id='".$seller_id."' "
.") As my_cart "
."JOIN items i "
."on i.item_id=my_cart.item_id ";
//echo $sql2;
$itemRows = $dbh->query($sql2);
?>
<!DOCTYPE html>
<html>
<head>
<?php
include "assets/includes.php";
?>
<link rel="Stylesheet" type="text/css" href="css/forms.css"/>
</head>
<body>
<?php include "menu.php"; ?>
<?php include "assets/list_items.php" ?>
<!-- The "info" div is the meat of the body, it contains the general information of the page. -->
<div class="info">
<!-- The "heading" div styles the heading of each section to stand out more and make it very readable.-->
<div class="heading">
<?php echo $this_user_seller["login_name"]."'s Shopping Cart" ?>
</div>
<br>
<ul class = "product_grid">
<?php
list_items($itemRows,"Cart Items")
?>
</ul>
<br>
<br>
</div>
</body>
</html>