回答です
This commit is contained in:
48
answer/Ex02.php
Normal file
48
answer/Ex02.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// Ex02.php - 表示用ファイル
|
||||
require_once __DIR__ . '/Ex02_query.php';
|
||||
|
||||
$employees = getEmployees();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Employees List</title>
|
||||
<link href="../common/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Employees List</h1>
|
||||
<?php if (!empty($employees)): ?>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>従業員ID</th>
|
||||
<th>プロジェクトID</th>
|
||||
<th>Salary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($employees as $emp): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($emp['id']); ?></td>
|
||||
<td><?php echo htmlspecialchars($emp['name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($emp['dep_id']); ?></td>
|
||||
<td><?php echo htmlspecialchars($emp['project_id']); ?></td>
|
||||
<td><?php echo htmlspecialchars($emp['salary']); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<p>No employee data found.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user