So I'm trying to use a PHP list plugin to run a select query which returns a single column (of email addresses). I want to somehow display the results of the select query to the user. I thought I would be able to put the results into the status message but I'm likely doing something wrong. Is this even possible? In a perfect world, it would display the results comma separated, ready for copy/paste into an email app. Thanks!
PHP:
// This will find all the email addresses of the student in the selected course
$db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
$schedule_id = $db->Quote('{sis_adm_course_schedule___schedule_id}');
$query = "
SELECT sis_adm_student.email FROM sis_adm_student
RIGHT JOIN sis_adm_enrollment ON sis_adm_enrollment.student_id = sis_adm_student.student_id
RIGHT JOIN sis_adm_course_schedule ON sis_adm_course_schedule.schedule_id = sis_adm_enrollment.schedule_id
WHERE sis_adm_course_schedule.schedule_id = $schedule_id
AND sis_adm_enrollment.status = 'Enrolled';
";
$db->setQuery($query);
// Run the query
$found = (int) $db->execute();
// Load a single row
$row = $db->LoadObject();
$statusMsg = $row;
Last edited: