rackem
Well-Known Member
I have the following code for a Scheduled Task.
All it does is pull a set of names from two rows of one table and inserts the set of unique names into another table. It performs as intended if I put it in the PHP Setup area of my scheduled task. However, if I wrap it into
in a PHP file in the plugins/fabrik_cron/php/scripts folder, then it won't run. All I get is a message saying 0 records updated.
I have other Scheduled Tasks that run from script files that work just fine. Any idea what might be going on here?
PHP:
$db = JFactory::getDbo();
$processed = 0;
$p_names = array();
$query = ("SELECT `name_p1`, `name_p2` FROM `mps_fargo_import` WHERE 1");
$db->setQuery($query);
$rows =$db->loadObjectList();
foreach ($rows as $r) {
array_push($p_names,$r->name_p1,$r->name_p2);
}
$p_names = array_unique($p_names);
$name_list = implode("'), ('", $p_names);
$query = ("INSERT INTO mps_fargo_import_names (`name`) VALUES ('$name_list')");
$db->setQuery($query);
$db->query();
$processed = $db->getAffectedRows();
All it does is pull a set of names from two rows of one table and inserts the set of unique names into another table. It performs as intended if I put it in the PHP Setup area of my scheduled task. However, if I wrap it into
PHP:
<?php
/* MOS Intruder Alerts */
defined('_JEXEC') or die('Restricted access');
/* My code here */
?>
in a PHP file in the plugins/fabrik_cron/php/scripts folder, then it won't run. All I get is a message saying 0 records updated.
I have other Scheduled Tasks that run from script files that work just fine. Any idea what might be going on here?