array_sum Qustion

Discussion in 'PHP' started by koolsamule, Jun 10, 2010.

  1. #1
    Hi Chaps,

    I'm after a bit of help with summing up some arrays, to build a Quote for a Project.

    - Project_ID
    - Job_ID (repeated for each Project_ID)
    - Task_ID (repeated for each Job_ID)

    Each Task_ID has it's own cost, so what I need to do is sum up the Tasks, to give a total for Job and likewise I need to sum up the Job totals to give a Project total.

    Hopefully this will give you some idea as to what I have in my database:
    The result I'm after is:
    Job_1 = £1000
    Job_2 = £900
    Project_1 = £1900
     
    koolsamule, Jun 10, 2010 IP