-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpurchase_history.php
69 lines (65 loc) · 2.46 KB
/
purchase_history.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
63
64
65
66
67
68
69
<?php
session_start();
if (isset($_SESSION['username'])) {
include_once("assets/scripts/php/login_header.php");
}
else {
echo "<a href = \"index.php\">You are required to log-in first!</a>";
die();
}
?>
<section class = "container-fluid sections-wrapper">
<section class = "jumbotron user-jumbotron text-center">
<h2>Pending Shipments</h2>
<?php
include_once "assets/scripts/php/db.php";
$shipments = "SELECT o_id 'ORDER ID', o_status DISPATCHED, o_date DATE FROM product_order "
. "WHERE c_id = '{$_COOKIE['username']}'";
//echo $purchase_history;
$result = $db->query($shipments);
$data = $result->fetch_assoc();
$count = mysqli_num_rows($result);
echo "<p>Total Shipments So Far : {$count}</p>";
?>
<table class="table table-hover table-responsive">
<thead>
<tr>
<?php
if( $count > 0)
{
foreach ($data as $key => $value)
{
echo "<th class = \"text-center\">{$key}</th>";
}
}
?>
</tr>
</thead>
<tbody>
<?php
if( $count > 0)
{
for ( $i = 0; $i < $count; $i++)
{
echo "<tr>";
foreach ($data as $key => $value)
{
echo "<td class = \"text-center\">{$value}</td>";
}
echo "<td><a class = \"li-orange\" href = 'order_details.php?order_id={$data['ORDER ID']}'>View</a></td>";
$data = $result->fetch_assoc();
echo "</a></tr>";
}
}
else
{
echo "<small>No Pending shipments!.</small>";
}
?>
</tbody>
</table>
</section>
<?php
include_once 'assets/scripts/php/footer.php';
?>
</body>