How can I display the following SQL query's results in PHP ?
SELECT CONCAT(
'SELECT `repagents`.full_name', GROUP_CONCAT('
, `t_', REPLACE(status, '`', '``'), '`.value
AS `', REPLACE(status, '`', '``'), '`'
SEPARATOR ''),
' FROM `repagents` ', GROUP_CONCAT('
LEFT JOIN `repagents` AS `t_', REPLACE(status, '`', '``'), '`
ON `repagents`.full_name = `t_', REPLACE(status, '`', '``'), '`.full_name
AND `t_', REPLACE(status, '`', '``'), '`.status = ', QUOTE(status)
SEPARATOR ''),
' GROUP BY `repagents`.full_name'
) INTO @qry FROM (SELECT DISTINCT status FROM `repagents`) t;
PREPARE stmt FROM @qry;
EXECUTE stmt;