-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShowAcctByID.php
83 lines (74 loc) · 2.84 KB
/
ShowAcctByID.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
// Login Credentials required.
require('../includes/ProtectMB.php');
// Destroy session at time limit.
require('../includes/SessionExpire.php');
//Turn on error reporting
ini_set('display_errors', 'On');
// Import dBase Credentials.
require('../../project/g3f2Kcd57nE4s25.php');
// Connect to the database.
$mysqli = new mysqli($servername, $username, $password, $database);
?>
<!DOCTYPE HTML>
<html>
<head>
<?php
include('../includes/HeadMB.php');
?>
</head>
<body>
<h1>MoonBuyers InterGalactic</h1>
<h2>Show Account By Account ID</h2>
<div class="container">
<h3>Confidential</h3>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th class="text-center bold">Account</th>
<th class="text-center bold">Balance</th>
<th class="text-center bold">Customer ID</th>
<th class="text-center bold">Form</th>
<th class="text-center bold">Company Name</th>
<th class="text-center bold">Address<span class="span-hide">_</span>1</th>
<th class="text-center bold">Address<span class="span-hide">_</span>2</th>
<th class="text-center bold">City</th>
<th class="text-center bold">State</th>
<th class="text-center bold">Planet</th>
<th class="text-center bold">Zip</th>
<th class="text-center bold">Phone</th>
</tr>
</thead>
<tbody>
<?php
if (!($stmt = $mysqli->prepare("SELECT A.id AS 'Account', A.Balance, Cu.id AS 'Cust_ID', Cu.Lname, Cu.Fname, Cu.Addr_1,
Cu.Addr_2, Cu.City, Cu.State, Cu.Planet, Cu.Zip, Cu.Phone
FROM Customers Cu
INNER JOIN Account A ON Cu.id = A.C_ID
WHERE A.id = ?"))) {
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if (!($stmt->bind_param("i", $_POST['Account_ID']))) {
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if (!$stmt->bind_result($Account, $Balance, $Cust_ID, $Lname, $Fname, $Addr_1, $Addr_2, $City, $State, $Planet, $Zip, $Phone)) {
echo "Bind failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
while ($stmt->fetch()) {
echo "<tr>\n<td>\n" . $Account . "\n</td>\n<td>\n" . $Balance . "\n</td>\n<td>\n" . $Cust_ID . "\n</td>\n<td>\n" . $Lname .
"\n</td>\n<td>\n" . $Fname . "\n</td>\n<td>\n" . $Addr_1 . "\n</td>\n<td>\n" . $Addr_2 . "\n</td>\n<td>\n" . $City .
"\n</td>\n<td>\n" . $State . "\n</td>\n<td>\n" . $Planet . "\n</td>\n<td>\n" . $Zip . "\n</td>\n<td>\n" . $Phone .
"\n</td>\n</tr>";
}
$stmt->close();
?>
</tbody>
</table>
<br>
<button type="button" class="button" onclick="location.href = 'IndexMB.php';">Return to Main Page</button>
</div>
</body>
</html>