Hi,
I'm out of ideas on how to get a date into my MySQL database correctly. I have a form working OK with all the other fields and have done a lot of the form coding by hand after starting with the wizard. My form has two date fields, each in the UK/AU format dd/mm/yyyy.
I understand that MySQL stores dates in its own format 'Y-m-d H:i:s' and I have tried to wrestle the date data into shape with some PHP I gathered from a post in this forum:
'empstartdate' and 'empenddate' are text fields in the form and I put this code into the onSubmit boxes in the Form Code tab. This gives me the error:
Fatal error: Can't use function return value in write context in C:\xampp\Joomla1-5\components\com_chronocontact\libraries\customcode.php(64) : eval()'d code on line 3
I have the date picker working and I've tried Y-m-d, but I can't get past the validation, despite the fact that it's turned off (Enable validation is set to No).
The other fields all link up fine (I can see the data in the MySQL records using PHPMyAdmin), but the date fields just show 0000-00-00.
What am I missing here? I've read through my ecopy of Bob's book and all the articles I can find, as well as the forum here. It's probably in front of my face, but I can't see it.
I can think of kludges to try, but would really like to know how to get any user-friendly date format into the DB.
I'm using Chronoforms 3.2 on Joomla 1.5.22.
Any suggestions greatly appreciated.
Thanks very much in advance.
Justin
I'm out of ideas on how to get a date into my MySQL database correctly. I have a form working OK with all the other fields and have done a lot of the form coding by hand after starting with the wizard. My form has two date fields, each in the UK/AU format dd/mm/yyyy.
I understand that MySQL stores dates in its own format 'Y-m-d H:i:s' and I have tried to wrestle the date data into shape with some PHP I gathered from a post in this forum:
<?php
JRequest::setVar('empstartdate') = date('Y-m-d H:i:s', strtotime(JRequest::getVar('empstartdate')));
JRequest::setVar('empenddate') = date('Y-m-d H:i:s', strtotime(JRequest::getVar('empenddate'))); ?>
'empstartdate' and 'empenddate' are text fields in the form and I put this code into the onSubmit boxes in the Form Code tab. This gives me the error:
Fatal error: Can't use function return value in write context in C:\xampp\Joomla1-5\components\com_chronocontact\libraries\customcode.php(64) : eval()'d code on line 3
I have the date picker working and I've tried Y-m-d, but I can't get past the validation, despite the fact that it's turned off (Enable validation is set to No).
The other fields all link up fine (I can see the data in the MySQL records using PHPMyAdmin), but the date fields just show 0000-00-00.
What am I missing here? I've read through my ecopy of Bob's book and all the articles I can find, as well as the forum here. It's probably in front of my face, but I can't see it.
I can think of kludges to try, but would really like to know how to get any user-friendly date format into the DB.
I'm using Chronoforms 3.2 on Joomla 1.5.22.
Any suggestions greatly appreciated.
Thanks very much in advance.
Justin