Jump to content


Photo

Update Syntax


  • Please log in to reply
7 replies to this topic

#1 paxwarrior86

paxwarrior86
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 September 2006 - 03:34 PM

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

#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 16 September 2006 - 04:09 PM

http://www.phpfreaks...c,101366.0.html

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 September 2006 - 04:29 PM

In case that's a little cryptic, the core problem is that you should never use reserved words 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...rved-words.html
Legend has it that reading the manual never killed anyone.
My site

#4 paxwarrior86

paxwarrior86
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 September 2006 - 04:41 PM

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.

#5 Shelly302

Shelly302
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 20 September 2006 - 03:56 PM

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!

#6 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 20 September 2006 - 05:34 PM

your problem is the single quotes. you may have to add slashed in to make the query work.

Ray

#7 Shelly302

Shelly302
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 September 2006 - 12:23 AM

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.

#8 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 21 September 2006 - 12:43 AM

If it's not your site, it's not your problem...
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users