Zimtgruen
Erfahrenes Mitglied
Was ist hier falsch, bei mir wird immer folgendes angezeigt, wenn ch die Seite aufrufen will.
Parse error: syntax error, unexpected T_ELSE in C:\Programme\xampp\htdocs\welcome\editauthor.php on line 68
Zimtgruen
Parse error: syntax error, unexpected T_ELSE in C:\Programme\xampp\htdocs\welcome\editauthor.php on line 68
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<STYLE TYPE="text/css">
<!--
A:link{ text-decoration: underline; color:#000000; }
A:visited{ text-decoration: underline; color:#000000; }
A:active{ text-decoration: underline; color:#000000; }
A:hover{ TEXT-DECORATION: none; color:#000000; }
-->
</style>
<body style="background-color:transparent; filter:chroma(color=#FFCC99)">
<STYLE type=text/css>
BODY {
font-family:"verdana",verdana,verdana;
scrollbar-base-color:;
scrollbar-3dlight-color:#000000;
scrollbar-arrow-color:#000000;
scrollbar-darkshadow-color:#000000;
scrollbar-face-color:#FFCC99;
scrollbar-highlight-color:#FFCC99;
scrollbar-shadow-color:#FFCC99;
scrollbar-track-color:;
}
</STYLE>
<font face="Verdana">
<font size="1">
<center>
<?php
$dbcnx = @mysql_connect('localhost', 'root', 'passwort');
if (!$dbcnx) {
exit('Verbindungsaufbau zum Datenbankserver ' .
' zurzeit nicht möglich.</p>');
}
if (!$mysql_select-db('Jokes')) {
exit('<p>Auswahl der Witzedatenbank' .
'zurzeit nicht möglich.</p>');
}
if (isset($_POST['name']));
// Die Details des Autors werden aktualisiert.
$name = $_POST['name'];
$email = $_POST['email'];
$id = $_POST['id'];
$sql = "UPDATE Authors SET
Name='$name',
EMail='$email'
WHERE ID='$id'";
if (@mysql_query($sql)) {
echo '<p>Details des Autors wurden aktualisiert.</p>';
} else {
echo '<p>Fehler beim Aktualisieren der Details: ' .
mysql_error() . '</p>';
?>
<p><a href="authors.php">Zurück zur Liste der Autoren</a></p>
<?php
else:
$id = $_GET['id'];
$author = @mysql_query(
"SELECT Name, EMail FROM Authors WHERE ID='$id'");
if (!$author) {
exit('<p>Fehler beim Lesen der Autorendetails: ' .
mysql_error() . '</p>');
}
$author = mysql:fetch_array($author);
$name = $author['Name'];
$email = $author['EMail'];
// Sonderzeichen konvertieren für die
// Benutzung als HTML-Attribute.
$name = htmlspecialchars($name);
$email = htmlspecialchars($email);
?>
<form action="<?php echo $_SERVER['PHP-SELF']; ?>" method="post">
<p>Autorendetails editieren:</p>
<label>Name: <input type="text" name="name" value="<?php echo $name; ?>" /></label><br />
<label>E-Mail: <input type="text" name="email" value="<?php echo $email; ?>" /></label><br />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" value="Speichern" /></p>
</form>
<?php endif; ?>
</body>
</html>
Zimtgruen
Zuletzt bearbeitet: