Yes, I know.  However, the while() loop should generate all the invoice in a
list.

-----Original Message-----
From: Giz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 12:03 AM
To: 'Ben C.'; [EMAIL PROTECTED]
Subject: RE: [PHP] Sum a column of values from a MySQL query


I think you're a big confused here.  Your query will only return one row,
because you're using sum().  $invoicepartpaid will be your total for the
invoiceid specified.

-----Original Message-----
From: Ben C. [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 11:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sum a column of values from a MySQL query

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----------------





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to