我想在我的网页上显示以下信息:
日期 - 个人费用(业务费用)
06-June-2012 - usd555.00 (usd3022.00)
05-June-2012 - usd666.00 (usd0.00)
04-June -2012 - usd0.00 (usd444.40)
04-June-2012 - usd333.00 (usd2333.40)
目前我的代码是:
$sql = "SELECT payment_date, sum(price) FROM expense WHERE category=? spender_id=? GROUP BY payment_date";
$q = $conn->prepare($sql);
$result = $q->execute(array("Personal", $user_id));
while($r = $q->fetch(PDO::FETCH_ASSOC)){
$payment_date_db = $r['payment_date'];
$payment_date_db2 = date("d-F-Y", strtotime($payment_date_db));
$price_db = $r['sum(price)'];
echo $payment_date_db2 . " - " . $money_currency . $price_db . "<br />";
}
我不知道如何选择和显示业务费用记录并将其显示到总括符号()中。任何的想法?