I have an academic table that contains data.
eg:
| level | percentage |
|---|---|
| Degree | 50 |
| Diploma | 70 |
| Post Diploma | 67 |
This is my code, but not working:
<table>
<tr>
<th>Degree</th>
<th>Diploma</th>
$stmtc = $conn->prepare("SELECT
MAX(CASE WHEN level = 'Degree' THEN percentage END) AS $degree,
MAX(CASE WHEN level = 'Diploma' THEN percentage END) AS $diploma
FROM tbl_academic_qualification WHERE member_no = '$emp_id'");
$stmtc->execute();
$resultc = $stmtc->fetchAll();
foreach($resultc as $rowc){
$degree = $rowc['percentage'];
$diploma = $rowc['percentage'];
?>
<tr>
<td><?php echo "$degree"; ?></td>
<td><?php echo "$diploma"; ?></td>
</tr>
</table>
I want to display like this:
| Degree | Diploma | Post Diploma |
|---|---|---|
| 50 | 70 | 67 |