如何在HTML中输出表中的“SELECT STATEMENT”

I have tables joined {Project, Task, expense} Project has a project name, and task has Job Type, then expense has the detailed information I needed.

project.project id = task.project_id

expense.task_id = task.task_id

so what I wanted to do is show it in groups

enter image description here

I have made several reports listing but I have not grouped them like this. I made this image easy by using a Reporting Tools in PowerBuilder(like Visual Basic). But I am not familiar if there is something I can use like those using PHP/MySQL. I use CodeIgniter by the way...