php - How can I add other data after the resulting query -
i have query.
$stmt = $this->getconnection()->prepare("select * detailuser id = ?"); $result = $stmt->fetchall(pdo::fetch_assoc);
and want add amount in result after dateadded, confuse how add amount. amount in table , have no reference on first table (detailuser)
$amount = 100;
$rec = array( 'data'=>$result, ); echo json_encode($rec); {"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"}]}
thank in advance
you can prepare select
statement fetch rows , in statement, can add dummy column.
select *, 100 'amount' table_name
Comments
Post a Comment