0

I'm getting an 'unexpected end of file error' on this page. I know that this error is usually caused by a missed bracket somewhere but I can't for the life of me, after an hour of trying figure out what specifically is causing the problem. Would be very appreciative if anyone has the time to have a look through and see if they can spot something I couldn't. Thanks in advance :)

<?php 
    if(!isset($_SESSION['permAuth'])) {
        ?>
            <script>
                window.location.replace('index.php');
            </script>
            <?php 
    } else {
    $level_sql="SELECT * FROM perms WHERE permLog=".$_SESSION['permAuth'];
    $level_query=mysqli_query($dbconnect, $level_sql);
    $level_rs=mysqli_fetch_assoc($level_query);
    if($level_rs['permAccess']=='0') {
        ?>
            <script>
                window.location.replace('index.php');
            </script>
            <?php 
        }

    include("links.php");

    //Fetch all comments from the database
    $comment_sql="SELECT * FROM comments ORDER BY commentID DESC LIMIT 8";
    $comment_query=mysqli_query($dbconnect, $comment_sql);
    $comment_rs=mysqli_fetch_assoc($comment_query);
?>

<div class="commentDisplayContainer2">
    <?php 
    //Stop site trying to display comments if none exist
    if(mysqli_num_rows($comment_query)==0) {
        ?><p>Sorry! No commments to display at this time</p>
    <?php } else {
        do {
            ?><div class="commentDisplayDiv2">
                <p><?php echo $comment_rs['commentID']; ?> - <?php echo $comment_rs['commentLog']; ?></p>
                <p><?php echo $comment_rs['commentText']; ?></p>
            </div>
            <?php
            } while ($comment_rs=mysqli_fetch_assoc($comment_query)); 
       }
       include("usercomment2.php"); 
       ?>
</div>
Clinky
  • 1
  • 2
    I'm not sure if it's because you're mixing tabs and spaces, but honestly if you fix your indentation it makes finding errors like this much easier. – Mike Jun 28 '18 at 03:15
  • Here's your file properly indented https://pastebin.com/aH2PDrWG. Either you didn't close `if($level_rs['permAccess']=='0') {` or you didn't close the `else`. – user3783243 Jun 28 '18 at 03:22

0 Answers0