-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
50 lines (44 loc) · 1.92 KB
/
Copy pathindex.php
File metadata and controls
50 lines (44 loc) · 1.92 KB
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
<?php
require('database.php');
$query = 'SELECT c.customerID, c.emailAddress, c.firstName, c.lastName, a.line1, a.city, a.state, a.zipCode, a.phone
FROM customers c INNER JOIN addresses a
ON c.customerID = a.customerID
GROUP BY customerID, emailAddress, firstName, lastName, line1, city, state, zipCode, phone; ';// PUT YOUR SQL QUERY HERE
// Example: $query = 'SELECT * FROM customers';
$statement = $db->prepare($query);
$statement->execute();
$customers = $statement->fetchAll();
$statement->closeCursor();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Guitar Shop Customers</title>
<link rel="stylesheet" href="css/main.css">
</head>
<!-- the body section -->
<body>
<header><h1>Customer List</h1></header>
<main>
<section>
<?php foreach ($customers as $customer) : ?>
<p><span class="bold">CustID:</span> <?php echo $customer['customerID']; ?></p>
<p><span class="bold">Email:</span> <?php echo $customer['emailAddress']; ?></p>
<p><span class="bold">FirstName:</span> <?php echo $customer['firstName']; ?></p>
<p><span class="bold">LastName:</span> <?php echo $customer['lastName']; ?></p>
<p><span class="bold">Address:</span> <?php echo $customer['line1']; ?></p>
<p><span class="bold">City:</span> <?php echo $customer['city']; ?></p>
<p><span class="bold">State:</span> <?php echo $customer['state']; ?></p>
<p><span class="bold">ZipCode:</span> <?php echo $customer['zipCode']; ?></p>
<p><span class="bold">Phone:</span> <?php echo $customer['phone']; ?></p>
<br>
<?php endforeach; ?>
</section>
</main>
<footer>
<p>© <?php echo date("Y"); ?> My Guitar Shop, Inc.</p>
</footer>
</body>
</html>