Reputation: 171
I cannot figure this one out. All the variables are ok. Printed out the sql statement before executing in php... This is the statement exactly as it is sent to be ran by php
INSERT INTO 'images' ('filename', 'creator', 'date', 'notes') VALUES ('cat.sdf', 'michaelamici', '2002-07-05', 'SDfdddfdffddffdfgs')
Thank You!
Upvotes: 1
Views: 47
Reputation: 12836
You're enclosing the table/field names in single-quotes. You need to do it with back-ticks (or nothing, depending on the name).
INSERT INTO `images` (`filename`, `creator`, `date`, `notes`) VALUES ('cat.sdf', 'michaelamici', '2002-07-05', 'SDfdddfdffddffdfgs')
Just in case you're interested, a list of reserved names (which must be quoted if used as a table or column name) can be found here: http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html.
Also, to find out what characters may be included in an unquoted name and which can appear only as part of a quoted name, see here: http://dev.mysql.com/doc/refman/5.5/en/identifiers.html.
N.B. the relevant MySQL version.
Upvotes: 5
Reputation: 1050
INSERT INTO `images` (`filename`, `creator`, `date`, `notes`) VALUES
('cat.sdf', 'michaelamici', '2002-07-05', 'SDfdddfdffddffdfgs');
Try editing single quotes to backquotes for table name and field names
Upvotes: 1
Reputation: 799430
Your table and field names should either be in backquotes (`) or unquoted.
Upvotes: 2