回答です

This commit is contained in:
a-kizaki
2026-10-28 16:53:31 +09:00
parent 06c1988850
commit fcaf9d4b5f
28 changed files with 10572 additions and 0 deletions

48
answer/Ex02.php Normal file
View 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>