Knuckles Posted April 1, 2010 Share Posted April 1, 2010 Im getting a error wich i cant seem to figure out where i gone wrong 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> Quote Link to comment Share on other sites More sharing options...
arbitter Posted April 1, 2010 Share Posted April 1, 2010 After WHERE id='" .$_POST["id"]; you forgot to close the apostrophes i think; make it WHERE id='" .$_POST["id"] ."'"; Quote Link to comment Share on other sites More sharing options...
Knuckles Posted April 1, 2010 Author Share Posted April 1, 2010 When i change it i get other error: Parse error: syntax error, unexpected '.' in C:\xampp\htdocs\admin\bewerk.php on line 14 When i remove the . i get the same error again Quote Link to comment Share on other sites More sharing options...
arbitter Posted April 1, 2010 Share Posted April 1, 2010 I accidetally forgot to delete the ';' WHERE id='" .$_POST["id"] ."'"; But I don't get what's wrong in line 14.. Quote Link to comment Share on other sites More sharing options...
Knuckles Posted April 1, 2010 Author Share Posted April 1, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.