Jump to content

Error in Profile Edit Script


Knuckles

Recommended Posts

Im getting a error wich i cant seem to figure out where i gone wrong  :wtf:

 

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='4' at line 9

 

<?php
session_start(); 
include("../config.php");

if (isset($_POST["bevestiging"])){
$query="UPDATE login SET
	gebruikersnaam = '". $_POST["gebruikersnaam"] ."', 
	voornaam = '". $_POST["voornaam"] ."', 
	achternaam = '". $_POST["achternaam"] ."', 
	adres = '". $_POST["adres"] ."', 
	postcode = '". $_POST["postcode"] ."' ,
	woonplaats = '". $_POST["woonplaats"] ."', 
	email = '". $_POST["email"] ."', 
	WHERE id='" .$_POST["id"];
$result = mysql_query($query) or die ("FOUT: " . mysql_error());
echo("De volgende opdracht is uitgevoerd: <b>$query</b><br>\n");
if ($result){
	echo ("Record nummer " .$_POST["id"] . " is bijgewerkt<br>\n");
	echo ("<a href=\"gebruikers.php\">Terug naar het overzicht</a>");
}
}else{
	$query="SELECT * FROM login WHERE id=" . $_GET["id"];
	$result = mysql_query($query) or die ("FOUT: " . mysql_error());
?>

<html>
<head>

<title>Admin Paneel</title>

<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->

<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
</head>

<body>
<div id="wrapper">
        <ul id="mainNav">
        	<li><a href="admin.php" >Home</a></li>
        	<li><a href="gebruikers.php" class="active">Gebruikersbeheer</a></li>
        	<li><a href="http://localhost/phpmyadmin/">Databasebeheer</a></li>
        	<li><a href="#">OPTION</a></li>
        	<li class="logout"><a href="logout.php">Log out</a></li>
        </ul>
    	
        <div id="containerHolder">


<table border="1" width="100%" align="center">
<?php
while ($rij = mysql_fetch_array($result)){
$gebruikersnaam = $rij['gebruikersnaam']; 
$voornaam = $rij['voornaam']; 
$achternaam = $rij['achternaam'];
$adres = $rij['adres'];
$postcode = $rij['postcode'] ;
$woonplaats = $rij['woonplaats'] ;
$email = $rij['email'] ;
}?>
<form action="<?php echo($_SERVER["PHP_SELF"]);?>" method="post">
<input type="hidden" name="bevestiging" value="1">
<input type="hidden" name="id" value="<?php echo($_GET["id"]);?>">
<center>Gebruikersnaam:	<br><input type="text" name="voornaam" value="<?php echo($gebruikersnaam);?>" size="30"><br>
Voornaam:	<br><input type="text" name="voornaam" value="<?php echo($voornaam);?>" size="30"><br>
Achternaam:	<br><input type="text" name="achternaam" value="<?php echo($achternaam);?>" size="30"><br>
Adres: <br><input type="text" name="adres" value="<?php echo($adres);?>" size="30"><br>
Postcode:<br> <input type="text" name="postcode" value="<?php echo($postcode);?>" size="30"><br>
Woonplaats:	<br><input type="text" name="woonplaats" value="<?php echo($woonplaats);?>" size="30"><br>
E-mail:	<br><input type="text" name="email" value="<?php echo($email);?>" size="30"><br></center>
<br>
<center><input type="Submit" value="Bijwerken">
<input type="Button" value="Terug" onclick="javascript:history.back();"></center>
</form>
<?php
}
?>   
                <div class="clear"></div>
            </div>
        </div>	
    </div>  
</body>
</html>

Link to comment
Share on other sites

I accidetally forgot to delete the ';'

WHERE id='" .$_POST["id"] ."'";

 

But I don't get what's wrong in line 14..

 

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='4'' at line 9

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.