Jump to content

Update Syntax


paxwarrior86

Recommended Posts

anyone have an idea why this isn't working??

1064: 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 'desc = 'Embroidered with children around the world.', country = 'Guatemala' WHE' at line 1

Here's my php code:

// Update Product
$query="UPDATE catalog SET sku = '$productsku', price = '$price', name = '$productname', desc = '$desc', country = '$country' WHERE sku = '$sku'";
Link to comment
https://forums.phpfreaks.com/topic/20980-update-syntax/
Share on other sites

In case that's a little cryptic, the core problem is that you should never use [b]reserved words[/b] as field names ... and desc is a reserved word. The desperate workaround is to replace desc with `desc` in your query. The right fix is to rename the field with something that isn't a MySQL reserved word.

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
Link to comment
https://forums.phpfreaks.com/topic/20980-update-syntax/#findComment-93071
Share on other sites

I'm sorry if this is the wrong place to post this, I'm new here.  You error just looked a lot like mine. 

My problem is I am unable to login to one of my fav websites anymore. The site side it sounded like it was on my side.  I just wanted to know what can I do to fix this, but I'm not a programer at all. lol ???

Here is the error.

MySQL 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 'Tomm'' at line 1, occured in query: "select location from member where username = 'S'Tomm'".

any help with this would be great. Thanks!
Link to comment
https://forums.phpfreaks.com/topic/20980-update-syntax/#findComment-95445
Share on other sites

Hello Ray, thanks for getting back to me so soon. :)  I have a few more question, the website got back to me and says that their system thinks I’m trying to log on as S Tomm but that’s not me. I am usually automatically logon to the site. They said they made some changes where you have to log in all the time now. Is it possible that something could of happen on their side when they made this change over? Another question, would someone have to manually type that code in, or could a system error cause this to happen?  The reason I ask is because I have no knowledge whatsoever of SQL. ??? I never even heard of a SQL until this error, I was wondering how this error could of happen? Could someone gain access and make changes to the SQL, or is there a malicious software that could of done this? I really would like to know because I would hate for something like this to happen again.  Since I don’t know who to fix SQL errors I’m now locked out of my own art gallery. :'(

Any info on this would be greatly appreciated.

Thanks so much.
Link to comment
https://forums.phpfreaks.com/topic/20980-update-syntax/#findComment-95763
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.