I am trying to sum a query of values from a MySQL table. The code I am using is:
---BEGIN CODE #1-------------- $sql_2 = "SELECT SUM(partpaidamount) as partpaid FROM $tb_name WHERE invoiceid = \"$invoiceid\" "; $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result_2)) { $invoicepartpaid = $row['partpaid']; } ---END CODE #2---------------- 1) The code returns the sum of a partially paid invoice. The individual invoice is 'partpaid'. WORKS...NO PROBLEM 2) The while() then return a list of partially paid invoices which is $invoicepartpaid. WORKS..NO PROBLEM 3) I then want to add the list of partially paid invoices ($invoicepartpaid) together. I AM STUCK HERE ADDING THE INVOICES AMOUNTS TOGETHER. If anyone can help I would greatly appreciate it. -------------------------------------------------------------------------- The content of this email message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php