-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathselect.php
More file actions
54 lines (49 loc) · 1.29 KB
/
select.php
File metadata and controls
54 lines (49 loc) · 1.29 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
<?php
require_once 'config.php';
require_once 'db.php';
$db = connect(
DB_HOST,
DB_NAME,
DB_USERNAME,
DB_PASSWORD
);
$records = fetchAll($db);
?>
<html>
<head>
<title>Select all from MYSQL table</title>
</head>
<body>
<h1>A simple table from docker in motion</h1>
<table>
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>Description</th>
<th>Age</th>
<th>Action</th>
</tr>
</thead>
<?php
if(count($records) > 0):
foreach($records as $record): ?>
<tr>
<td><?php echo $record->id; ?></td>
<td><?php echo $record->first_name; ?></td>
<td><?php echo $record->last_name; ?></td>
<td><?php echo $record->description; ?></td>
<td><?php echo $record->age; ?></td>
<td><a href="delete.php?id=<?php echo $record->id;?>">Delete</a></td>
</tr>
<?php endforeach;
else: ?>
<tr>
<td colspan="5">Cannot find any records</td>
</tr>
<?php endif ?>
</tbody>
</table>
</body>
</html>