-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProcessed.php
69 lines (58 loc) · 2.23 KB
/
Processed.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
<html lang="en">
<head>
<meta charset="utf-8">
<title>671BookStore</title>
<link href="style.css" rel="stylesheet">
<script type='text/javascript' src="scripts.js"></script>
</head>
<body onload="showMenu()">
<h1>
671 BookStore
</h1>
<div class = "menu" style="margin-bottom: 2em;">
<center>
<a href=".">Home</a>
<a href="books.php">Books</a>
<a href="search.php">Search</a>
<a id="signin" style='display:none' href="sign_in.php">Sign in</a>
<a id="register" style='display:none' href="register.php">Register</a>
<a id="myaccount" style='display:none' href="myaccount.php">My Account</a>
<a id="admin" style='display:none' href="admin.php">Admin</a>
<a id="signout" style='display:none' onclick="signout()" href="index.php">Sign Out</a>
</center>
</div>
<h1>processed Purchases</h1>
<?php
$con = mysqli_connect("dbproject.saadmtsa.club", "root", "password", "dbproject");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "(Select *
from orders
Where State = 3)";
$result = mysqli_query($con, $query);
$table = mysqli_fetch_all($result);
foreach ($table as $row) {
if ($row[2] <= 2) {
$State1 = "Unprocessed";
} else {
$State1 = "Processed";
}
echo "<center>
<div class='bookInfo'>
<h4>OrderID: $row[0]</h4>
<h4>UserName: $row[1]</h4>
<h4>State: $State1</h4>
<h4>DateTime: $row[3]</h4>
</div>
<br padding=20px></br>
</center> ";
}
if (isset($_POST['done'])) {
header('Location: admin.php');
exit();
}
$con->close();
?>
</body>
</html>