Update doet het niet
dit is de error
FOUT: 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 id='1'' at line 5
dit is de php pagina:
-----------------------------------------------------------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include("sqlconnect.php");
if (isset($_POST["bevestiging"])){
$query="UPDATE vandijklinks SET
link_txt = '". $_POST["link_txt"] . "',
link_url = '". $_POST["link_url"] . "',
img_url = '". $_POST["img_url"] . "',
WHERE id='". $_POST["id"]. "'";
$result = mysql_query($query) or die ("FOUT: " . mysql_error());
echo("<br>De opdracht is uitgevoerd.<br><br>\n");
if ($result){
echo("Alles is bijgewerkt<br><br>\n");
echo("Kijk op de site voor het resultaat.<br><br>Klik <a href=\"links_main.php\"><b>hier</b></a> om terug te keren naar het hoofdmenu.");
}
}else{
$query="SELECT * FROM vandijklinks WHERE id='" . $_GET["id"]."'";
$result=mysql_query($query) or die ("FOUT: " .mysql_error());
?>
include("sqlconnect.php");
if (isset($_POST["bevestiging"])){
$query="UPDATE vandijklinks SET
link_txt = '". $_POST["link_txt"] . "',
link_url = '". $_POST["link_url"] . "',
img_url = '". $_POST["img_url"] . "',
WHERE id='". $_POST["id"]. "'";
$result = mysql_query($query) or die ("FOUT: " . mysql_error());
echo("<br>De opdracht is uitgevoerd.<br><br>\n");
if ($result){
echo("Alles is bijgewerkt<br><br>\n");
echo("Kijk op de site voor het resultaat.<br><br>Klik <a href=\"links_main.php\"><b>hier</b></a> om terug te keren naar het hoofdmenu.");
}
}else{
$query="SELECT * FROM vandijklinks WHERE id='" . $_GET["id"]."'";
$result=mysql_query($query) or die ("FOUT: " .mysql_error());
?>
<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="border-top:1px solid #0E4C1B;border-left:1px solid #0E4C1B;border-right:1px solid #0E4C1B;border-bottom:1px solid #0E4C1B;">
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
while (list($id, $link_txt, $link_url, $img_url) = mysql_fetch_row($result)){
$ltxt=$link_txt;
$lurl=$link_url;
$iurl=$img_url;
}
?>
while (list($id, $link_txt, $link_url, $img_url) = mysql_fetch_row($result)){
$ltxt=$link_txt;
$lurl=$link_url;
$iurl=$img_url;
}
?>
<form action="" method="post">
<table width="100%" border="0">
<tr>
<td width="15%" valign="top"><font face="verdana"> </font></td>
<td width="85%"><input name="bevestiging" type="hidden" value="1">
<input name="id" type="hidden" value="">
</td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>LINK TEKST:</strong></font></td>
<td><input name="link_txt" type="text" value="" size="50"></td>
</tr>
<tr>
<td valign="top"><font face="verdana"> </font></td>
<td> </td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>LINK URL:</strong></font></td>
<td><input name="link_url" type="text" value="" size="50"></td>
</tr>
<tr>
<td valign="top"><font face="verdana"> </font></td>
<td> </td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>IMAGE URL:</strong></font></td>
<td><input name="img_url" type="text" value="" size="50"></td>
</tr>
<tr>
<td valign="top"> </td>
<td> </td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>IMAGE VOORBEELD:</strong></font></td>
<td></td>
</tr>
<tr>
<td valign="top"> </td>
<td> </td>
</tr>
<tr>
<td valign="top"> </td>
<td><input type="submit" value="update"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
?>
----------------------------------------------------------
ik heb PHP version 4.3.4 en MySQL 4.0.15
please help
geven?