Mail contains different date than form

Hi,

In a former CF 7 form, I used the following PHP to get data from JEvents. In the front end, the user could check all dates and they were correctly sent by mail.

After having migrated to CF 8, I have a strange problem: In the front end, the dates are displayed correctly. But in the mail, it displays always the last of same named events instead of the one that is chosen.

How comes?

The option text path is: <table><tr><td style="width:85px"><strong>{row:dtstart_formatted}:</strong> </td><td>{row:summary}</td></tr></table>

Strange enough: When I do not format the UNIX date, then frontend as well as mail show the exact same UNIX value. But... of course, I cannot display that...

The PHP is as follows, and the mail just contains {email:data_table}

$current_day = JFactory::getDate('+0 seconds');

$current_day = $current_day->toUnix();

$db =& JFactory::getDBO();

$query = "SELECT

#__jevents_vevdetail.dtstart,

#__jevents_vevdetail.summary,

#__jevents_vevdetail.extra_info

FROM #__jevents_vevdetail

INNER JOIN #__jevents_vevent ON #__jevents_vevdetail.evdet_id = #__jevents_vevent.detail_id

WHERE    #__jevents_vevdetail.dtstart > " . $current_day ." AND

#__jevents_vevent.access = 1 AND

#__jevents_vevent.state >= 1order by #__jevents_vevdetail.dtstart;

";

$db->setQuery($query);

$rows = $db->loadAssocList();

foreach ($rows as &$r) {

$r['dtstart_formatted'] = date('d.m.Y', $r['dtstart']);

}

return $rows;

Please note: I am not a programmer. The above code was constructed with the help of this forum, years ago.

Thanks so much for your help!

Martin

Post a Reply