Giri J Posted September 20, 2009 Share Posted September 20, 2009 Hello All, I have a problem with my update query. The insert query works fine with all the values. But when I use the update query it throws me error. I'm stuck. please help. Here is my update query in php $q1="update vehicle SET vdesc='$vDesc',SET vimg='$vImg1',SET user='$uid',SET log=now() where vname='$vName'"; Here are my values (retrieved from form): $vDesc=This is my vehicle test $vImg1=1.jpg $uid=test $vName=My Car Model 000T Here is the error message: 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 vimg='1.jpg',SET user='test',SET log=now() where vname='My Car Model 000' at line 1 Please help... Thanks a lot in advance. Quote Link to comment https://forums.phpfreaks.com/topic/174922-solved-php-mysql-update-query-error/ Share on other sites More sharing options...
Calver Posted September 20, 2009 Share Posted September 20, 2009 Hello, I think you only need one 'SET'. Try it like this... $q1="update vehicle SET vdesc='$vDesc', vimg='$vImg1', user='$uid', log=now() where vname='$vName'"; Quote Link to comment https://forums.phpfreaks.com/topic/174922-solved-php-mysql-update-query-error/#findComment-921838 Share on other sites More sharing options...
Giri J Posted September 21, 2009 Author Share Posted September 21, 2009 Brilliant Calver... this works .... Thanks a lot for the help .... :) Quote Link to comment https://forums.phpfreaks.com/topic/174922-solved-php-mysql-update-query-error/#findComment-922080 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.