有mysql查询的困难

Image. 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>`

I don't see a WHERE clause after all of your JOINs.

WHERE borrow.member_id=$id;

(This is NOT literally what you should write into your query. You'll need to validate/sanitize/parameterize the $_GET for security reasons.)

For your case, this time, you can get away with sanitizing like this prior to putting it in the query:

$id = intval($_GET['id']);

...but definitely read up on parameterization.