Jump to content

Archived

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

paxwarrior86

Update Syntax

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'";

Share this post


Link to post
Share on other sites
http://www.phpfreaks.com/forums/index.php/topic,101366.0.html

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
thank you.  that worked. i just changed the column name.  i thought from the first reply that i needed add curlies which i had already tried.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites
your problem is the single quotes. you may have to add slashed in to make the query work.

Ray

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
If it's not your site, it's not your problem...

Share this post


Link to post
Share on other sites

×

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.