Page 1 of 1

WTH is wrong with this query?!?

Posted: Mon Nov 25, 2002 7:44 am
by superwormy
INSERT INTO messages SET ( toaddress = 'test@durdenwebapplications.com' , fromaddress = 'Keith Palmer &lt[semicolon]keithp@logosoftwear.com&gt[semicolon]' , ccaddress = '' , bccaddress = '' , replyaddress = 'Keith Palmer &lt[semicolon]keithp@logosoftwear.com&gt[semicolon]' , senderaddress = 'Keith Palmer &lt[semicolon]keithp@logosoftwear.com&gt[semicolon]' , subject = 'subject' , message = 'message\r\n\r\nasdgljkasdg\r\n\r\n\r\nasdg' , md5 = '6e727e1461d8ea112ebf1b570618b655' , attatchment = 0 , datetime = NOW() , ID = 0 , folder_ID = 1 , status = 9 , user_ID = 2 )

You have an error in your SQL syntax near '( toaddress = 'test@durdenwebapplications.com' , fromaddress = 'Keith Palmer &lt

Posted: Mon Nov 25, 2002 8:03 am
by twigletmac
It might be the parenthesis since the INSERT syntax you are using doesn't seem to require them:
http://www.mysql.com/doc/en/INSERT.html

Mac

Posted: Tue Nov 26, 2002 3:56 pm
by Crashin
Isn't SET supposed to be used with UPDATE and WHERE, and not with INSERT INTO? Ex:

Code: Select all

UPDATE messages SET ( toaddress = 'test@durdenwebapplications.com' , fromaddress = 'Keith Palmer &ltїsemicolon]keithp@logosoftwear.com&gtїsemicolon]' , etc.) WHERE id=$yourid
For INSERT INTO you would have:

Code: Select all

INSERT INTO messages (field list) VALUES (value list)
SET is used to update an existing record; INSERT INTO is used to create a new record. At least that's how I've always understood it...

Posted: Tue Nov 26, 2002 5:30 pm
by mydimension
nope, you can use SET like that. that how i prefer to do cause the field name is near the value. makes it easier for me to read.

Posted: Tue Nov 26, 2002 5:35 pm
by Crashin
That's good to know... :)