login  Naam:   Wachtwoord: 
Registreer je!
 Forum

sql syntax error (Opgelost)

Offline anoop - 21/12/2007 17:17
Avatar van anoopLid hey


  1. <?php
  2. if(mysql_connect('localhost','root',''))
  3. {
  4. }
  5. else
  6. {
  7. echo 'Kan geen verbinding maken';
  8. }
  9.  
  10.  
  11. if($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST))
  12. {
  13. $aFouten = array();
  14. if($_POST['your_nick'] == '')
  15. {
  16. $aFouten[] = 'You didnt fill in your own ingame or irc nick';
  17. }
  18. if($_POST['target'] == '')
  19. {
  20. $aFouten[] = 'You didnt fill in a target';
  21. }
  22. if($_POST['bullets'] == '' || !is_numeric($_POST['bullets']))
  23. {
  24. $aFouten[] = 'You didnt fill in a possible amound of bullets --> only numbers allowed (not 60k --> 60000)';
  25. }
  26.  
  27. if(count($aFouten) != 0)
  28. {
  29. echo 'There are some faults: <br /><br />';
  30. for($Fi = 0; $Fi < count($aFouten); $Fi++)
  31. {
  32. echo $aFouten[$Fi].'<br />';
  33. }
  34. echo '<br />Click <a href="javascript:history.go(-1);">here</a> to go back';
  35. }
  36. else
  37. {
  38. $sNick = addslashes($_POST['your_nick']);
  39. $sTarget = addslashes($_POST['target']);
  40. $sBullets = addslashes($_POST['bullets']);
  41.  
  42. mysql_query("UPDATE Iets SET
  43. killer='".$sNick."', bullets='".$sBullets."', niveau='4', WHERE target = ".$sTarget." ") or die(mysql_error());
  44. echo 'Youve confirmed your kill. Thanks and respect for shooting!';
  45. }
  46.  
  47. }
  48. else
  49. {
  50. ?>
  51. <form action=" <?=$_SERVER['PHP_SELF']?> " method="POST">
  52. Your ingame/irc nick: <input type="text" name="your_nick"><br />
  53. Target: <input type="text" name="target"><br />
  54. Bullets: <input type="text" name="bullets"><br />
  55. <input type="submit" name="verzenden" value="Confirm kill">
  56. </form>
  57. <?
  58. }
  59. ?>


hoort het allemaal te doen, maar krijg dit:
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 target = Tafel' at line 2

iemand die weet hoe dat goed moet..?

4 antwoorden

Gesponsorde links
Offline lemoinet - 21/12/2007 17:21
Avatar van lemoinet PHP gevorderde komma voor where wegdoen
Offline anoop - 21/12/2007 17:23
Avatar van anoop Lid oke gedaan lemoinet:)
maar krijg dan nu dit:
Unknown column 'Tafel' in 'where clause'
Offline Koen - 21/12/2007 19:32
Avatar van Koen PHP expert
  1. mysql_query("UPDATE `Iets` SET
  2. `killer` ='".$sNick."', `bullets` ='".$sBullets."', `niveau` = 4 WHERE `target` = '".$sTarget."' ") or die(mysql_error());
  3. echo 'You\'ve confirmed your kill. Thanks and respect for shooting!';

En dit?
Offline anoop - 21/12/2007 19:59
Avatar van anoop Lid
sliphead schreef:
[..code..]
En dit?


JAAH:D:D
hartstikke bedankt:D
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.19s