Running a MySQL INSERT query, where the only 3 dynamic variables are an e-mail address and 2 date('Y-m-d H:i:s') fields.
I'm getting the 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 'LIST_SUBSCRIBER' at line 1
My Query:
$today = date('Y-m-d H:i:s');
INSERT INTO subscriber_table (
list_subscriber, user_subscriber, robot_subscriber, date_subscriber,
update_subscriber, visibility_subscriber, reception_subscriber,
subscribed_subscriber, included_subscriber
)
VALUES (
'newsletter', $email, 'listserv.valoans.com', $today, $today, 'conceal', 'mail', '1', '0'
)
All SELECT queries work correctly.
$emailin your query? You could also switch to using a prepared statement, which takes care of that sort of thing for you.2013-08-31is going to be interepreted as a 3-term arithmetic subtraction, and end up being1974.'2013-08-31'(note the quotes) will be treated as a date (or at least a string).