1

$sql = "UPDATE 'load' SET 'graphe'=".$graphe."','intersection'='".$intersection."','ville'='".$ville ."' where id= '".$id."'";

I'm using the above after a search and the person said it corrected the syntax. When I run it I get failed.

Thanks

Pete

  • If you're getting an error, provide the error. Also, you are wide open for [SQL injection](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php), assuming that you aren't doing any input sanitization. – Patrick Q Apr 26 '14 at 01:54

1 Answers1

0

Change ' to ` AND insert ' before ".$graphe

$sql = "UPDATE `load` SET `graphe`='".$graphe."',`intersection`='".$intersection."',`ville`='".$ville ."' where id='".$id."'";
Lucas Henrique
  • 1,380
  • 1
  • 11
  • 15
  • Thanks , that did it. No wonder I missed it, the quotes look so similar that even when I had the right code I wasn't putting in the right quotes. I even dug up some old ASP code that required the same type of syntax but again I copied what I THOUGHT I saw and not what was really there. I can't vote up the answer cuz my reputation is low but will do so when I can. Pete – user3574937 Apr 26 '14 at 12:53
  • @user3574937 Thank you. You can not vote, but I think you can accept the answer. Please check. – Lucas Henrique Apr 26 '14 at 12:55