Why won't this work?
<!-- editauthor.php -->
<HTML>
<HEAD>
<TITLE> Edit Author </TITLE>
</HEAD>
<BODY>
<?php
$dbcnx = @mysql_connect("localhost", "8888888888", "888888");if (!$dbcnx) { echo( "<P><b>Unable to connect to the database server at this time.</b></P>" ); exit();}
mysql_select_db("petesmc_articles");
if ($submit): // The author's details have
// been updated.
$sql = "UPDATE authors SET " .
"Name='$name', " .
"Description='$description', " .
"Email='$email' " .
"WHERE ID=$id";
if (mysql_query($sql)) {
echo("<P>Author details updated.</P>");
} else {
echo("<P>Error updating author details: " .
mysql_error() . "</P>");
}
?>
<P><A HREF="authors.php">Return to Authors list</A></P>
<?php
else: // Allow the user to edit the author
// with ID=$id
$author=mysql_query("SELECT Name, Email, Descriptio " .
"FROM Authors " .
"WHERE ID=$id");
if (!$author) {
echo("<P>Error fetching author details: " .
mysql_error() . "</P>");
exit();
}
$author = mysql_fetch_array($author);
$name = $author["Name"];
$email = $author["Email"];
$description = $author["Description"]
// Add slashes to database
// values for use as HTML attributes
$name = addslashes($name);
$email = addslashes($email);
$description = addslashes($description);
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Edit the author BR>
Name: <INPUT TYPE=TEXT NAME="name" VALUE="<?php echo($name); ?>" SIZE=20 MAXLENGTH=100><BR>
eMail: <INPUT TYPE=TEXT NAME="email" VALUE="<?php echo($email); ?>" SIZE=20 MAXLENGTH=100><BR>
Description<textarea name="description" ROWS=15 COLS=45 WRAP></textarea>
<INPUT TYPE=HIDDEN NAME="id" VALUE="<?php echo($id); ?>">
<INPUT TYPE=SUBMIT NAME="submit" VALUE="SUBMIT"></P>
</FORM>
<?php endif; ?>
</BODY>
</HTML>
Can be found at http://216.74.101.27/admin.html
select manage authors, then create an author, then try to edit it.
Error on line 51 i think, the part about the slashes
No semicolon on the end of line 47
$description = $author["Description"]
it should read
$description = $author["Description"];
That oughta fix it!
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks