Jump to content


Photo

Insert INTO not working


  • Please log in to reply
3 replies to this topic

#1 thndr

thndr
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 February 2006 - 02:43 AM

Hello again,
Small problem.
INSERT INTO trans (Amount,Desc,Date,Empty) VALUES('5.95','Fees','02.01.06','W')
it returns:
Query failed : 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,Date,Empty) VALUES('5.95','Fees','02.01.06','W')
Thats not working, what did I miss? The first field in the DB structure is ID, and i moved servers, I used to just use "INSERT INTO trans VALUES ('','price') etc, but it doesnt allow that for the ID field on new server so Im trying to do it the other way and its not working. TIA.
John

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 02 February 2006 - 02:54 AM

DESC is a reserved word (DATE should be too but mysql allows it). Try this:

INSERT INTO trans (Amount,`Desc`,Date,Empty) VALUES('5.95','Fees','02.01.06','W')


#3 thndr

thndr
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 February 2006 - 03:31 AM

Ah I should have known I think I had problems with that before, thanks!

#4 fenway

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

Posted 02 February 2006 - 04:02 AM

DATE is reserved, but only for CREATE/ALTER TABLE statements. Still, no need to use it.
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