Hi all,
I have this (function:PHP) code which is currently running fine in CC6.
Need some directions of making this using the CC6 tools.
read, save, loop...
thanks
I have this (function:PHP) code which is currently running fine in CC6.
Need some directions of making this using the CC6 tools.
read, save, loop...
thanks
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM `#__chronoforms_data_recommendation`
WHERE `applicant_exist` = '' AND `year` = '2021'";
$db->setQuery($query);
$recommendations = $db->loadObjectList();
foreach ( $recommendations as $r ) {
// get matching applications
$query = "
SELECT `aid`
FROM `#__chronoforms_data_scholarship-application`
WHERE `applicant_firstname` = '{$r->applicant_firstname}'
AND `applicant_lastname` = '{$r->applicant_lastname}'
AND `year` = '2021'
LIMIT 1 ;
";
$db->setQuery($query);
$applicant_aid = $db->loadResult();
// check if any matches found
if ( !$applicant_aid ) {
//echo '<i class="icon-ban-circle red"> <i>No matches found</i></i>';
continue;
}
// Update the recommendation
$query = "
UPDATE `#__chronoforms_data_recommendation`
SET `applicant_exist` = {$applicant_aid}
WHERE `aid` = {$r->aid}
";
$db->setQuery($query);
$db->query();
}
// TODO
// in applications {view:table} display count of how many recommendations have the same applicant aid).
//count on-the-fly and not write to table.