ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

how do i convert this php in cc6?

zest96 17 Dec, 2020
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
$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.
Max_admin 23 Dec, 2020
Answer
if the code is working then keep it and return the value you need then use it in other actions, there is no need to build the code in CC6 tools
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
You need to login to be able to post a reply.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com