PHP抛出解析错误:语法错误,意外'&引用';

PHP抛出解析错误:语法错误,意外'&引用';,php,html,mysql,database,phpmyadmin,Php,Html,Mysql,Database,Phpmyadmin,我制作了一个系统,员工可以在其中查看他们申请的休假状态。我正在尝试根据用户是否登录显示申请的休假状态 下面是一个例子: 因此,登录的用户是John Doe,但出于某种原因,我可以看到其他用户申请的休假。我只想让约翰·多伊看看他自己的申请表 下面是我想到的代码: <div class="container"> <div class="page-header"> <h3>My Leaves</h3> <d

我制作了一个系统,员工可以在其中查看他们申请的休假状态。我正在尝试根据用户是否登录显示申请的休假状态

下面是一个例子:

因此,登录的用户是John Doe,但出于某种原因,我可以看到其他用户申请的休假。我只想让约翰·多伊看看他自己的申请表

下面是我想到的代码:

<div class="container">
    <div class="page-header">
        <h3>My Leaves</h3>
        <div class="table-responsive">
            <table class="table">
                <tr>
                    <th>Employee Name</th>
                    <th>Phone</th>
                    <th>Email</th>
                    <th>From</th>
                    <th>To</th>
                    <th>Reason</th>
                    <th>Status</th>
                </tr>
                <?php
                include ('database.php');
                $result = $database->prepare ("SELECT leaves.* FROM leaves INNER JOIN employee ON employee.id = leaves.user_id WHERE employee ON employee.id = leaves.user_id WHERE employee.username = $_SESSION["VALID_USER_ID"]");
                $result ->execute();
                for ($count=0; $row_message = $result ->fetch(); $count++){ ?>
                <tr>
                    <td><?php echo $row_message['full_name']; ?></td>
                    <td><?php echo $row_message['phone']; ?></td>
                    <td><?php echo $row_message['email']; ?></td>
                    <td><?php echo $row_message['fromdate']; ?></td>
                    <td><?php echo $row_message['todate']; ?></td>
                    <td><?php echo $row_message['reason']; ?></td>
                    <td><?php echo $row_message['status']; ?></td>
                </tr>
                <?php } ?>
            </table>
            <a href="home"><button type="button" class="btn btn-primary"><i class="glyphicon glyphicon-arrow-left"></i> Back</button></a>
        </div>
    </div>
</div>
我不知道是什么

以下是我的表格模式:


您将按以下方式更改查询并尝试

$result = $database->prepare ("SELECT leaves.* FROM leaves INNER JOIN employee ON employee.id = leaves.user_id WHERE employee ON employee.id = leaves.user_id WHERE employee.id = ".$_SESSION["VALID_USER_ID"]);

只需将结尾改为
employee.username=“.$\u SESSION[“VALID\u USER\u ID”];
非常感谢。所有申请的休假详细信息都消失了,但是的,我想这是另一个问题。再次感谢
$result = $database->prepare ("SELECT leaves.* FROM leaves INNER JOIN employee ON employee.id = leaves.user_id WHERE employee ON employee.id = leaves.user_id WHERE employee.id = ".$_SESSION["VALID_USER_ID"]);