Fejl i update set
HejHar kastet mig ud i noget php og sql og er ret blank.
i det følgende kan man rette i et link. Den sender fint variablerne ind i tekstfelterne, men så snart man siger "ret" kommer følgende fejl
Link kunne ikke opdateres You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE link_id='19\\\''' at line 5
Synes nu altså bare ikke der er en fejl. Nogen der kan hjælpe?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TITLE</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
include 'ps.inc.php';
if (isset($_POST['url'])):
$url = $_POST['url'];
$title = $_POST['title'];
$description = $_POST['description'];
$id = $_POST['link_id'];
$sql = "UPDATE links SET
url='$url',
title='$title',
description='$description',
WHERE link_id='$id'";
if (@mysql_query($sql)) {
echo '<p>Link opdateret</p>';
} else {
echo '<p>Link kunne ikke opdateres ' .
mysql_error() . '</p>';
}
?>
<p><a href="link_manage.php">Return to authors list</a></p>
<?php
else:
$id = $_GET['link_id'];
$link = @mysql_query(
"SELECT url, title, description FROM links WHERE link_id='$id'");
if (!$link) {
exit('<p>Error fetching author details: ' .
mysql_error() . '</p>');
}
$link = mysql_fetch_array($link);
$url = $link['url'];
$title = $link['title'];
$description = $link['description'];
$url = htmlspecialchars($url);
$title = htmlspecialchars($title);
$description = htmlspecialchars($description);
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>Edit the author:</p>
<label>Name: <input type="text" name="url" value="<?php echo $url; ?>" /></label><br />
<label>Email: <input type="text" name="title" value="<?php echo $title; ?>" /></label><br />
<label>Email: <input type="text" name="description" value="<?php echo $description; ?>" /></label><br />
<input type="hidden" name="link_id" value="<?php echo $id; ?>" />
<input type="submit" value="SUBMIT" /></p>
</form>
<?php endif; ?>
</body>
</html>