Kara
Kara

Reputation: 11

MySql error regarding update

What should i do for this error? This is my query:

UPDATE person  
SET 
  Name = '$Name', 
  Address = '$Address', 
  Email = '$Email', 
  Telephone = '$Telephone',  
WHERE Id = '$Id'; 

but when executing, it gives this kind of error:

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 = '$Id' at line 2

Upvotes: 0

Views: 31

Answers (1)

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26258

The issue is here

,  WHERE Id

their is an extra comma following WHERE in query, remove it. So the query is like:

"UPDATE person  SET Name = '$Name' , Address = '$Address' , Email = '$Email' , Telephone = '$Telephone'  WHERE Id = '$Id' ;" 

Upvotes: 3

Related Questions