diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-30 09:46:48 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-30 09:46:48 +0300 |
commit | d1e17342764dd8373af14f5896e721769c3917cb (patch) | |
tree | 2f05c6521320a6153155e4770643b95dd218b347 | |
parent | CRUD bugs (diff) | |
download | bugtracker-d1e17342764dd8373af14f5896e721769c3917cb.tar.xz |
bug/view: show associated reports
-rw-r--r-- | bug/view.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bug/view.php b/bug/view.php index d1e4335..6b26860 100644 --- a/bug/view.php +++ b/bug/view.php @@ -24,6 +24,30 @@ echo "<p><b>$result[title]</b></p>"; echo "<p>Submitted by $result[submitter]</p>"; echo '<p>' . $markdown->text($result['description']) . '</p>'; +echo "<h2>Reports</h2>"; +# reports query +$reports = $conn->prepare("SELECT reports.id AS id, title, description, users.username AS user + FROM reports JOIN users ON reports.author=users.id WHERE bug=:bug_id ORDER BY id"); +$reports->bindParam(':bug_id', $_GET['id']); +$reports->execute(); + +if($reports->rowCount() > 0) { +?> + +<table style='width:80%'> +<tr><th>Title</th><th>Description</th><th>Submitted by</th></tr> +<?php +foreach ($reports as $row) { + echo "<tr><td><a href=report/view.php?id=$row[id]>$row[title]</a></td> <td>" . truncate($row['description']) . "</td> <td>$row[user]</td></tr>\n"; +} +?> +</table> + +<?php +} else { + echo "<p>No reports</p>"; +} + if(session_set()) { echo "<p><a href=edit.php?id=$_GET[id]>Edit</a> | <a href=delete.php?id=$_GET[id]>Delete</a></p>"; } |