How to append this data to my resulting set

How to append this data to my resulting set

jemzjemz Posts: 131Questions: 40Answers: 1
edited September 2015 in Free community support

I am querying to my table

 ```
     $stmt = $this->getconnection()->prepare("SELECT * FROM detailuser where id = ?");
     $result = $stmt->fetchAll(PDO::FETCH_ASSOC);


          $rec = array(
              'data'=>$result,
            );

 echo json_encode($rec);

```

and this is the result.

      {"data":[{"firstname":"Alex","friendname":"Alice","amount_due":"600.00","dateadded"
:"2015-09-14 13:30"},{"firstname":"Annie","friendname":"Karren","amount_due":"600
.00","dateadded":"2015-09-14 13:30"},{"firstname":"Helen","friendname":"Alice","amount_due":"600.00","dateadded":"2015-09-14 13:30"}]}

Now I want to add the amount on it.

this amount column is in the other table and I have no reference on it to my first query table.

how can I append this

"Amount";"100" ?

Thank you in advance.

This discussion has been closed.