. I've been working on this app and I have some minor problems. The basic one, where everything goes on further, is the MySQL query. I'll put the code and I will upload the picture for you to see the outcome of this problem. So basically I want the query to show only results that are from that "id" I got from GET method. Therefore, it prints every single thing from databasem doesn't matter which id. But the column of those who are not as the GET "id", are blank. I would like them to disappear and to show only that match up with get id Thank you in advance.
<?php
require_once 'requires/dbconnect.php';
require_once 'requires/session.php';
require_once "requires/head.php";
require_once 'requires/navbar.php';
$id = $_GET['id'];
$query = $DBcon->query("SELECT * FROM borrow
LEFT JOIN users ON borrow.member_id = users.id AND borrow.member_id = '$id'
LEFT JOIN borrowdetails ON borrow.borrow_id = borrowdetails.borrow_id AND borrowdetails.member_id = '$id'
LEFT JOIN book ON borrowdetails.book_id = book.book_id
ORDER BY borrow.borrow_id DESC");
?>
<div class="container">
<table class="table table-hover table-bordered">
<tr class="active">
<td><b>Book Title</b></td>
<td><b>Username</b></td>
<td><b>Date Borrowed</b></td>
<td><b>Date Returned</b></td>
<td><b>Status</b></td>
<td></td>
</tr>
<tr>
<?php
while ($row = $query->fetch_array()) {
$id = $row['borrow_id'];
$member_id = $row['member_id'];
$book_id = $row['book_id'];
$borrow_details_id = $row['borrow_details_id'];
?>
<td><a href="bookbrief.php?id=<?php echo $book_id; ?>"><?php echo $row['book_title']; ?></a></td>
<td><a href="profile.php?id=<?php echo $member_id; ?>"><?php echo $row['username']; ?></a></td>
<td><?php echo $row['date_borrow']; ?></td>
<td><?php echo $row['date_return']; ?> </td>
<td><?php echo $row['borrow_status'];?></td>
<?php
if($row['borrow_status'] == 'pending')
{ ?>
<td class="danger">Pending</td>
<?php }
else if ($row['borrow_status'] == 'returned') { ?>
<td class="success">Returned</td>
<?php } ?>
</tr>
<?php } ?>
</table>
</div>`