dimoss
Well-Known Member
Hi,
I have a scheduled task using the following script to update the 'status' of each record in the DB table 'fab_tournaments' when today date is greater that 'tour_end' (datetime):
Running the scheduled task from the backend doesnt update the records as it should be. It always return "0 records updated" which is wrong as there records where the condition is met.
On #__fabrik_log I get:
"8,Undefined property: stdClass::$id,/xxx/xxx/xxxx/plugins/fabrik_cron/php/php.php(75) : eval()'d code,12"
Any help is appreciated.
I have a scheduled task using the following script to update the 'status' of each record in the DB table 'fab_tournaments' when today date is greater that 'tour_end' (datetime):
PHP:
$enddate = strtotime("{fab_tournaments___tour_end}");
$nowdate = strtotime("today");
$non_active = '0';
$active = '1';
$db = JFactory::getDbo();
$db->getQuery(true);
$query = $db->getQuery(true);
foreach ($data as $group) {
foreach ($group as $row) {
$query->clear()
->update('fab_tournaments')
->where('id = ' . (int)$row->id);
if ($nowdate > $enddate)
{
$query->set('status = ' . $db->quote($non_active));
}
else
{
$query->set('status = ' . $db->quote($active));
}
$db->setQuery($query);
$db->execute();
}
}
Running the scheduled task from the backend doesnt update the records as it should be. It always return "0 records updated" which is wrong as there records where the condition is met.
On #__fabrik_log I get:
"8,Undefined property: stdClass::$id,/xxx/xxx/xxxx/plugins/fabrik_cron/php/php.php(75) : eval()'d code,12"
Any help is appreciated.