Mesh3L Posted April 14, 2011 Share Posted April 14, 2011 Hello,I'm not sure if this should be here or on the PHP forum. sorry.-----I have been stuck with this for 2 hours now and have read lots google results without any success.The following query gives me an error :"UPDATE marker SET type='$type', for='$for' WHERE id = '$id'"also tried :"UPDATE `marker` SET `type`='$type',`for`='$for' WHERE `id`='$id'"also :"UPDATE marker SET type='$type', SET for='$for' WHERE id = '$id'"also :"UPDATE marker SET type='$type' AND SET for='$for' WHERE id = '$id'"also :"UPDATE marker SET type='$type' AND for='$for' WHERE id = '$id'"i tried many others also.The error is something like :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 'SET for='Sale' WHERE id = '1'' at line 1IT ONLY WORKS FOR A SINGLE FILED QUERY LIKE :"UPDATE marker SET type='$type' WHERE id = '$id'"How can i get this thing work ?!Thanks, Link to comment Share on other sites More sharing options...
justsomeguy Posted April 14, 2011 Share Posted April 14, 2011 Since "FOR" is a reserved word in MySQL, you need to surround the name with backquotes. So, this is the correct version:"UPDATE `marker` SET `type`='$type',`for`='$for' WHERE `id`='$id'"If that doesn't work, print out the query you generate to check for errors. Link to comment Share on other sites More sharing options...
Mesh3L Posted April 14, 2011 Author Share Posted April 14, 2011 I thought i tried this! it WORKED !Thanks justsomeguy .. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.