Skip to content

Commit

Permalink
Show Hospital Name instead of ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjaelp committed Feb 17, 2021
1 parent 54e2c5e commit 3146630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pages/dataOverview.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include("../templates/db-connect.php");

$sql = "SELECT * FROM pd_pairs ORDER BY pair_id";
$sql = "SELECT pd_pairs.*, hospitals.name as hosp_name FROM pd_pairs LEFT JOIN hospitals on pd_pairs.hosp_id = hospitals.id ORDER BY pair_id";
$result = mysqli_query($conn, $sql);
$result_array = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_free_result($result);
Expand Down Expand Up @@ -33,7 +33,7 @@
<th>Pair ID</th>
<th>Patient ID</th>
<th>Donor ID</th>
<th>Hosp ID</th>
<th>Hospital Name</th>
<th>Status</th>
<th>Edit</th>
<th>Delete</th>
Expand All @@ -49,7 +49,7 @@
<td><?php echo $row['pair_id'] ?></td>
<td><?php echo $row['patient_id'] ?></td>
<td><?php echo $row['donor_id'] ?></td>
<td><?php echo $row['hosp_id'] ?></td>
<td><?php echo $row['hosp_name'] ?></td>
<td>
<a href="../include/toggleStatus.inc.php?pair_id=<?php echo $row['pair_id']?>&hosp_id=<?php echo $row['hosp_id']?>" class="checkDisable button success confirmStatus"><?php echo $row['status'] ?></a>
</td>
Expand Down
4 changes: 3 additions & 1 deletion pages/pairData.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
exit();
}

$hData = getHospitalById($conn, $pData['hospital']);

//calculate BMI and Date
$pBMI = bmiVal($pData['height'], $pData['weight']);
$pCreated = formatDate($pData['created_at']);
Expand Down Expand Up @@ -242,7 +244,7 @@
</tr>
<tr>
<th>Hospital</th>
<td><?php echo $pData['hospital'] ?></td>
<td><?php echo $hData['name']; ?></td>
</tr>
<tr>
<th>Provisional Clearance</th>
Expand Down

0 comments on commit 3146630

Please sign in to comment.