Block mistake in code

Hi all, in my code i try to connect to a database and retrieve a list of students. These students have a link, and if i click on one of those links, i will get additional information of a single student. The code is like this:

[php]

Studentregister

<?php

require_once (‘auth.php’);
require_once (‘student.class.php’);

//vis en enkelt post
if (isset($_GET[‘id’])) {
$id = (int)$_GET[‘id’];
$stmt = $dbh->prepare(“SELECT * FROM studenter WHERE id= :id”);
$stmt->bindParam(’:id’, $id);
$stmt->execute();

if ($student = $stmt->fetch()) {
    print("Navn: " . $student['etternavn'] . "<br />\n");
    print("Klasse: " . $student['klasse'] . "<br />\n");
    print("Mobil: " . $student['mobil'] . "<br />\n")
}
else {
    echo "Beklager, fant ingen poster!";
}

}
else {
while ($student = $stmt->fetch() {
print("<a href=" . $_SERVER[‘PHP_SELF’] . “?id=” . $student->hentId() . “>”. $student->hentNavn() . “
\n”);
}
}
?>

[/php]

I am able to access the database, but i get a silly error no matter what i do:
Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\Lab4\db2_endret.php on line 23

Obviously a block is missing or shouldn’t be somewhere, but i cannot understand where. Are there anyone here who can point me in the right direction?

Start with line 23. See anythin wrong? What about line 22? Anything wrong there?

LOL, that one on #22 jumped out at me! Listen to Astonecipher…

Sponsor our Newsletter | Privacy Policy | Terms of Service