dlabacs Posted July 19, 2011 Share Posted July 19, 2011 Hi i have this code that doesn't work , I don't know hot to fix this . $sql ="UPDATE advert Set ad_Type = ' Fill wanted ',ad_Volume = ' gfgf ',ad_Weight = ' 89fgfgf ',ad_Street_No = ' fgfgf ',ad_Street_Name = ' lkl ',ad_Suburb = ' lkl ',ad_Postcode = ' klk ',ad_State = ' llkl ' WHERE id = 78 "; 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 ' ad_Type = ' Fill wanted ', ad_Volume = ' gfgf ', ad_Weight = ' 89fgf' at line 1 :'( Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/ Share on other sites More sharing options...
btherl Posted July 19, 2011 Share Posted July 19, 2011 That code looks ok to me. What happens if you set just one column? Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/#findComment-1244440 Share on other sites More sharing options...
dlabacs Posted July 19, 2011 Author Share Posted July 19, 2011 I made a change Sir like you've said but still doesn't work. I got the same error. I don't know what happen. I got no idea. $sql ="UPDATE advert Set ad_Type = ' Fill wanted ', ad_Volume = ' gfgf ', ad_Weight = ' 89fgfgf ', ad_Street_No = ' fgfgf ', ad_Street_Name = ' lkl ', ad_Suburb = ' lkl ', ad_Postcode = ' klk ', ad_State = ' llkl ' WHERE id = 78 "; Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/#findComment-1244450 Share on other sites More sharing options...
btherl Posted July 19, 2011 Share Posted July 19, 2011 What I mean is like this: $sql = "UPDATE advert Set ad_Type = ' Fill Wanted ' WHERE id = 78 "; Can you please also post the code you use to execute the query, and the table definition. Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/#findComment-1244451 Share on other sites More sharing options...
mwobobia Posted July 19, 2011 Share Posted July 19, 2011 I have a similar problem but mine is more complicated since am supposed to approve the student in the database if true by use of checkbox or submit button to indicate that the detail given by student is true. I have the following query: my php code does not update the record i have to use ref_no(primary key) in the record to specify the data selected for approval the data is in the same table in database ilo(person approving) can select more than one students(people in stored in database) for approval. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/#findComment-1244485 Share on other sites More sharing options...
dlabacs Posted July 19, 2011 Author Share Posted July 19, 2011 I got the codeworking now sir, ..actually it's a mistake on my part. Whern I look at my tables, I set postcode and volume as integer, not a varchar, that is why I got some errors. Anyway, thanks for the idea sir, i was able to found out the answer. cheers! Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/#findComment-1244560 Share on other sites More sharing options...
btherl Posted July 19, 2011 Share Posted July 19, 2011 Good to hear that mwobobia, please start a new thread for your question, and say what part of it is not working. Link to comment https://forums.phpfreaks.com/topic/242300-mysql-update-code-doesnt-work/#findComment-1244935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.