crosstab using php & mysql

I have a database table in this format

Date_from  date_to   charge  amount
====================================

01/01/15   07/01/15   AGTI     500
01/01/15   07/01/15   AGTII    700.50
08/01/15   14/01/15   AGTI     330.19
08/01/15   14/01/15   AGTII    540.19

Now I want to display it like this depending on the date range given by user

charge  01/01/15-07/01/15        08/01/15-14/01/15          total
==================================================================
AGTI     500                            330.19          

               830.19
AGTII    700.50                        540.19              

          1240.69
====================================================================
Total    1200.50                        870.38              

           2070.88

If user select 01/01/15-07/01/15 from date calender then only 01/01/15-07/01/15 column and total value will come and if select 01/01/15-14/01/15 than column for 2

weeks and total value will display. I am badly stuck with this one please help.. 


Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.