title: PHP - Counting some values in column hieararchy
body: <p>i need help to calculate a value inside a hierarchy array. I have a table like this:</p>
  
  <pre><code>+--------+------------+-------+-----------+
  | kia_id |  kia_name  | value | parent_id |
  +--------+------------+-------+-----------+
  |      1 | ac service |       |         0 |
  |      2 | hil        |       |         0 |
  |      3 | dispatch   |       |         1 |
  |      4 | tat main   | 13.3  |         3 |
  |      5 | tat air    | 10.1  |         3 |
  |      6 | sla comp   | 11.7  |         2 |
  |      7 | sla serv   |       |         2 |
  |      8 | slb        | 9.9   |         7 |
  +--------+------------+-------+-----------+
  </code></pre>
  
  <p>i want to display to html that table like this :</p>
  
  <pre><code>+--------+----------------+-------+-----------+------------------------+
  | kia_id |    kia_name    | value | parent_id | total_value_from_child |
  +--------+----------------+-------+-----------+------------------------+
  |      1 | ac service     |       |         0 | 23.4                   |
  |      3 |    dispatch    |       |         1 | 23.4                   |
  |      4 |       tat main | 13.3  |         3 |                        |
  |      5 |       tat air  | 10.1  |         3 |                        |
  |      2 | hil            |       |         0 | 21.6                   |
  |      6 |    sla comp    | 11.7  |         2 |                        |
  |      7 |    sla serv    |       |         2 | 9.9                    |
  |      8 |       slb      | 9.9   |         7 |                        |
  +--------+----------------+-------+-----------+------------------------+
  </code></pre>
  
  <p>how to count all child value to set the total of this parent, please help me..</p>