You are here: Re: mysql query question « PHP Programming Language « IT news, forums, messages
Re: mysql query question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация