Posted by Steve on 04/25/06 17:19
Try breaking it up into 2 queries.
q1:
SELECT paymentAmount, f_invoiceID
FROM payments
WHERE f_clientID = XXXX
Then create an array based on invoice ID
....
$invoices = array();
while($row = mysql_fetch_assoc()) {
// assuming PHP 4.x.x or lower here
$invoices[$row["f_invoiceID"]] += $row["paymentAmount"];
}
You will then have an array indexed by invoice ID with the sum of
payments as the data.
Then do another query to grab the invoice data from the invoice table,
based on this array.
Navigation:
[Reply to this message]
|