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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php