-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_getData.php
More file actions
60 lines (56 loc) · 1.92 KB
/
Copy path2_getData.php
File metadata and controls
60 lines (56 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
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<?php
$con = mysqli_connect("localhost","root","PASSWORD","webapp_test");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//formulate SQL query to obtain customers information
$get_cusRegData_sql = "SELECT cLogID, cusFirstName, cusLastName, cusEmail, submit_Time FROM cusRegData";
//send query and store result set in $result
$result = mysqli_query($con, $get_cusRegData_sql) or die ("Query failed:".mysqli_error($con));
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title> getData from MySQL Database </title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
</head>
<body>
<div class="px-5 py-3">
<h1>Here are registration details</h1>
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th> Log ID</th>
<th> First Name</th>
<th> Last Name</th>
<th> Customer Email</th>
<th> Submit Date</th>
</tr>
</thead>
<?php
//go through the result set, putting each row into an array $result_row
while ($result_row = mysqli_fetch_array($result)) {
//put the row details into variables $cLogID,$submit_Time,$cusFirstName,$cusLastName,$cusEmail
$cLogID = $result_row['cLogID'];
$cusFirstName = $result_row['cusFirstName'];
$cusLastName = $result_row['cusLastName'];
$cusEmail = $result_row['cusEmail'];
$submit_Time = $result_row['submit_Time'];
//output all
echo "
<tr>
<td>$cLogID</td>
<td>$cusFirstName</td>
<td>$cusLastName</td>
<td>$cusEmail</td>
<td>$submit_Time</td>
</tr>";
}
?>
</table>
</div>
</body>
</html>