By demiurgus on
OK, I'm pretty tired, so I need someone else to help me sort this out.
I'm trying to store a date in ther format "2006-11-02" into a MySQL database DATE column,
I have a #date field in my form and create the string in hook_verify from the array, and I pass this string in my INSERT and UPDATE statements, via db_query, which I suspect reformats it somehow.
Please help me save my date!
Comments
The value for #date is an array
The value for #date is an array, so you can serialize it and story as a string in varchar field or if you want to store it as a date you will need to convert the array to a format that works.
I got that much already
That's why I, like I said, convert the array into a string of format '2006-11-03' which the MySQL documentation says it accepts as a value for a DATE column, but it still won't save properly.
I will try to change the column to VARCHAR and see what's really stored.
Issue solved, bug found
It was all due to a bug in the API descriptions of hook_verify. In the API it says that changes can be made to $node, it is even passed by reference, but actually this is not possible, you have to use the new hook_submit for that.
Better to have no documentation at all than a faulty one, I say.