This topic is locked
[SOLVED]

  Updating a date field to current date

9/17/2013 5:22:11 PM
PHPRunner General questions
G
g_parry author

I know I'm going to look stupid in the end but I've been trying to make this work for two weeks now. I have a field - Printed_date formatted as a date in MySQL that I am updating to the current date when the record is exported. It's a simple query -
CustomQuery("UPDATE 'Printed_date' = Now() WHERE ID=".$data["ID"]);
I've tried every single variation of this and keep getting this 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 'Printed_date' = Now() WHERE ID=15' at line 1
HELP <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=21373&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=21373&image=2&table=forumtopics' class='bbc_emoticon' alt=':blink:' />

C
cgphp 9/17/2013

Where is the table name you want to update? The SQL syntax for UPDATE is:

UPDATE table_name

SET column1=value1,column2=value2,...

WHERE some_column=some_value;


The single quotes around Printed_date are not needed.

G
g_parry author 9/17/2013



Where is the table name you want to update? The SQL syntax for UPDATE is:

UPDATE table_name

SET column1=value1,column2=value2,...

WHERE some_column=some_value;


The single quotes around Printed_date are not needed.


I swear you have some influence over my application Cristian - it worked perfectly thank you but I swear I've tried that exact same statement a million times before and it failed.
Seriously - thank you