Hi
I used the cf to insert form into a mysql db. It works fine apart from one thing. I have a date field in my form that selects the date in format DD/MM/YYYY but the default value of the mysql field is 0000-00-00. The date never insterts into the date column instead entering the default value. I have the columns set as type date.
Do I need to do something to my form, db table to get the date to enter correctly?
Thanks
I used the cf to insert form into a mysql db. It works fine apart from one thing. I have a date field in my form that selects the date in format DD/MM/YYYY but the default value of the mysql field is 0000-00-00. The date never insterts into the date column instead entering the default value. I have the columns set as type date.
Do I need to do something to my form, db table to get the date to enter correctly?
Thanks
Hi decbuck,
There's always a problem with date formats. You have a choice of saving as Date, Timestamp, or Text field and you need to handle the necessary conversion in the OnSubmit After box.
Because of the ambiguity in dd/mm & mm/dd formats you'll probably need to explode your dd/mm/yyyy date into an array, then use date() to convert the array elements into the MySQL format. (I think that using date will validate the date as well.)
Bob
There's always a problem with date formats. You have a choice of saving as Date, Timestamp, or Text field and you need to handle the necessary conversion in the OnSubmit After box.
Because of the ambiguity in dd/mm & mm/dd formats you'll probably need to explode your dd/mm/yyyy date into an array, then use date() to convert the array elements into the MySQL format. (I think that using date will validate the date as well.)
Bob
Hi decbuck,
Not without writing it from scratch . . . but Google is your friend - try this thread or Google on "save dd/mm/yyyy as mysql date php" for more.
Bob
Not without writing it from scratch . . . but Google is your friend - try this thread or Google on "save dd/mm/yyyy as mysql date php" for more.
Bob
Hi
Still having a few problems with this. I am trying to access my form variables in the "On Submit code - after sending email: (PHP code with tags) " code and I cannot. How do I know my variable names. Are these from the form code as in the "id"
I undertand the conversion stuff but just cannot access the variables.
Also, when exactely is it put into the db. Is it after this last "after sending e-mail" is executed?
Many thanks.
Still having a few problems with this. I am trying to access my form variables in the "On Submit code - after sending email: (PHP code with tags) " code and I cannot. How do I know my variable names. Are these from the form code as in the "id"
I undertand the conversion stuff but just cannot access the variables.
Also, when exactely is it put into the db. Is it after this last "after sending e-mail" is executed?
Many thanks.
This topic is locked and no more replies can be posted.
