Update doet het niet

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

04/04/2004 02:57:00
Quote Anchor link
ik heb een update pagina gemaakt maar die werkt niet hij geeft steeds een error

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)
PHP script in nieuw venster Selecteer het PHP script
1
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());
?>



<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)
PHP script in nieuw venster Selecteer het PHP script
1
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;
}

?>

<form action="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo($_SERVER["PHP_SELF"]);?>
" method="post">
<table width="100%" border="0">
<tr>
<td width="15%" valign="top"><font face="verdana">&nbsp;</font></td>
<td width="85%"><input name="bevestiging" type="hidden" value="1">
<input name="id" type="hidden" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo($_GET["id"]);?>
">
</td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>LINK TEKST:</strong></font></td>
<td><input name="link_txt" type="text" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo($ltxt);?>
" size="50"></td>
</tr>
<tr>
<td valign="top"><font face="verdana">&nbsp;</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>LINK URL:</strong></font></td>
<td><input name="link_url" type="text" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo($lurl);?>
" size="50"></td>
</tr>
<tr>
<td valign="top"><font face="verdana">&nbsp;</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>IMAGE URL:</strong></font></td>
<td><input name="img_url" type="text" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo($iurl);?>
" size="50"></td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top"><font face="verdana"><strong>IMAGE VOORBEELD:</strong></font></td>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo("<img src=\"$iurl\" widht=\"200\" height=\"200\">"); ?>
</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td><input type="submit" value="update"></td>
</tr>
</table>
</form>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
}
?>
</td>
</tr>
</table>
</body>
</html>

?>

----------------------------------------------------------

ik heb PHP version 4.3.4 en MySQL 4.0.15

please help
 
PHP hulp

PHP hulp

28/04/2024 14:15:05
 
Rick

Rick

04/04/2004 05:11:00
Quote Anchor link
kan je eventjes het resultaat van
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<? echo $query; ?>
geven?
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.