Cannot Figure Out INSERT Query Error
Posted: Wed Sep 02, 2009 9:21 am
I cannot figure out why my INSERT query has an error.
Here is my table schema:
NOTE:With the CURDATE() I am attemping to populate the datetime type field with a current date and time stamp. The 5 values after that are not variables but literal values. The rest with the preceedig $ are of course php variables.
And here is the error it is returning:
Thank you.
-Joe
Here is my table schema:
- text_field1 text
text_field2 text
text_field3 text
text_field4 text
created_date datetime
bool1 tinyint(1)
num_of_days int(11)
bool2 tinyint(1)
bool3 tinyint(1)
bool4 tinyint(1)
name_field1 varchar(25)
long_msg1 longtext
Code: Select all
mysql_query("INSERT INTO msgtbl (text_field1, text_field2, text_field3, text_field4, created_date, bool1, num_of_days, bool2, bool3, bool4, name_field1, long_msg1')
VALUES ('$text_val1', '$text_val2', '$text_val3', '$text_val4', CURDATE(), '0', '7', '1', '1', '0', '$name_val1', '$my_msg')") or die(mysql_error());
And here is the error it is returning:
What do I have malformed in my sql query?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 '') VALUES ('4883032953', 'Anonymous', 'Anonymous', 'No Subject', CURDATE(), '0'' at line 1
Thank you.
-Joe