I'm a complete newbie to programming and php, my code's throwing back an error saying there's an unexpected end to the file and I can't for the life of me see what's missing or there that shouldn't be. Can anyone spot it?
<html>
<head>
<title><?php echo $firstname; ?> <?php echo $lastname; ?>'s Profile</title>
</head>
<body>
<?php
if (isset($_GET['username'])){
$username = $_GET['username'];
mysql_connect("localhost","root", "") or die ("Could not connect to the server");
mysql_select_db("users") or die ("That database could not be found.");
$userquery = mysql_query("SELECT * FROM users WHERE username='$username'") or die ("The query could not be completed, please try again later.");
if(mysql_num_rows($userquery) !=1){
die ("That user could not be found.");
}
while($row = mysql_fetch_array($userquery, MYSQL_ASSOC)) {
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$email = $row['email'];
$dbusername = $row['dbusername'];
$access = $row['access'];
}
if($username != $dbusername){
die ("There has been a fatal error, please try again.");
}
if($access == 1) {
$access = "Level 1 User";
} else
if($access == 2) {
$access = "Level 2 User";
} else
if($access == 3) {
$access = "Level 3 User";
} else
if($access == 4) {
$access = "Administrator.";
} else die ("This user has an access level beyond the realms of possibility. Beware.");
?>
<h2><?php echo $firstname; ?> <?php echo $lastname; ?>'s Profile</h2><br />
<table>
<tr><td>Firstname:</td><td><?php echo $firstname; ?></td></tr>
<tr><td>Lastname:</td><td><?php echo $lastname; ?></td></tr>
<tr><td>email:</td><td><?php echo $email; ?></td></tr>
<tr><td>dbusername:</td><td><?php echo $dbusername; ?></td></tr>
<tr><td>access:</td><td><?php echo $access; ?></td></tr>
</table>
</body>
</html>