javascript – What is the solution "unexpected end of file"?-ThrowExceptions

Exception or error:

I’m using PHP in my coding and it says “unexpected end of file”..Following is my code…Please help me to sort this out.

<?php
session_start();
include '../config/dbconnection.php';
$session= $_SESSION['userrow'];

if (isset($_GET['schedule_date']) && isset($_GET['app_id'])) {
    $app_date =$_GET['schedule_date'];
    $app_id = $_GET['app_id'];
}

$res = mysqli_query($conn,"SELECT a.*, b.* FROM lecturer_schedule a INNER JOIN user b
WHERE a.schedule_date='$appdate' AND schedule_id=$app_id AND b.user_id=$session");
$userrow=mysqli_fetch_array($res,MYSQLI_ASSOC);



//INSERT
if (isset($_POST['appointment'])) {
$user_id = mysqli_real_escape_string($conn,$userRow['user_id']);
$schedule_id = mysqli_real_escape_string($conn,$app_id);
$comment = mysqli_real_escape_string($conn,$_POST['comment']);
$avail = "notavail";


$query = "INSERT INTO appointment (  user_id , schedule_id , app_comment  )
VALUES ( '$user_id', '$schedule_id', '$app_comment') ";

$result = mysqli_query($conn,$query);

$sql = "UPDATE lecturer_schedule SET book_avail = '$avail' WHERE schedule_id = $schedule_id" ;
$scheduleres=mysqli_query($conn,$sql);

if ($scheduleres) {
    $btn= "disable";
} 

if( $result )
{
?>
<script type="text/javascript">
alert('Appointment made successfully.');
</script>
<?php }
else
{
    echo mysqli_error($conn);
?>
<script type="text/javascript">
alert('Appointment booking fail. Please try again.');
</script>

<!DOCTYPE html>
<html>
    <head>
        <title>Faculty Management System</title>
        <link rel="stylesheet" href="https://formden.com/static/cdn/font-awesome/4.4.0/css/font-awesome.min.css" />

    </head>
    <body>
            <div id="main">
           <?php
           include '../templates/header.php'; ?>
            <?php 
            include '../templates/userrole.php'; ?>

            <div class="container">
                <div class="row">
                    <form class="form" role="form" method="POST" accept-charset="UTF-8">
                        <div class="panel panel-default">
                            <div class="panel-heading">Student Information</div>
                                <div class="panel-body">
                                Student Name: <?php echo $userRow['patientFirstName'] ?> <?php echo $userRow['patientLastName'] ?><br>
                                Student IC: <?php echo $userRow['icPatient'] ?><br>
                                Contact Number: <?php echo $userRow['patientPhone'] ?><br>
                                Email Address: <?php echo $userRow['patientAddress'] ?>
                                </div>
                        </div>

                        <div class="panel panel-default">
                            <div class="panel-heading">Appointment Information</div>
                                <div class="panel-body">
                                Day: <?php echo $userRow['scheduleDay'] ?><br>
                                Date: <?php echo $userRow['scheduleDate'] ?><br>
                                Time: <?php echo $userRow['startTime'] ?> - <?php echo $userRow['endTime'] ?><br>
                                </div>
                        </div>

                        <div class="form-group">
                            <label for="message-text" class="control-label">Comment:</label>
                                <textarea class="form-control" name="comment" required></textarea>
                        </div>

                        <div class="form-group">
                        <input type="submit" name="appointment" id="submit" class="btn btn-primary" value="Make Appointment">
                        </div>
                    </form>
        </div>
            </div>

           </div>
    </body>
 </html>

It gives the following error when executed in localhost.

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\wbfms\view\appointment.php on line 102

and line 102 refers to ..

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *