Fetching data fails


#1

Hi all,

For my project I’m running this query which actually gives me the correct results when I run it with SequelPro.
When running this query like the code below, an error is returned. Undefined index: milestones. I don’t understand why because milestones is actually there when I run this query manually. I also tried render_complex_sql but also no luck there.

Can somebody please help me out here? :unamused:

if ($connector->is_select_mode()) {

            $query = "
            SELECT 
            	events.*
			FROM (
				SELECT 
					events.*,
					offers.id AS offer_id, 
					GROUP_CONCAT(CONCAT(DATE_FORMAT(offer_milestones.date, '%d-%m-%Y'),' - ', offer_milestones.description) SEPARATOR '-') AS milestones
				FROM 
					events 					
				JOIN 
					offers ON offers.project_id = events.project_id 
				JOIN 
					offer_milestones ON offer_milestones.offer_id = offers.id
			) events
			GROUP BY events.id";

            $connector->render_sql($query, 'id', 'start_date,end_date,text,desc,task_id,tree_task_id,user_id,color,project_id,project_name,organisation,important,milestones');
        
} else {

            $connector->render_table('events', 'id', 'start_date,end_date,text,desc,user_id,color,project_id,project_name,important,task_id,tree_task_id,organisation');

}