tghounsell
Member
I need the secret decoder ring for this! When I echo it out, $dt->format('Y-m-d') outputs exactly what I would expect: eg. '2021-09-02'. But I have tried a dozen variations and cannot seem to find a way to properly populate the field. I've tried making the stay_date column a date, a jdate, and a plain text field. As a date or jdate field, nothing is populated. When I turn stay_date into a plain text column, it seem to populate an unexpected year value only.
What am I doing wrong here?
Thanks!
What am I doing wrong here?
Thanks!
PHP:
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->insert('guest_bookings')
->set('stay_date = '. $dt->format('Y-m-d'))
->set('request_id = ' . $requestId);
$myDb->setQuery($myQuery);
$myDb->execute();