Re: Re: [PHP] Addin a column of numbers not using MySQL
| From: | Ben C . | Date: | Mon, 04 Aug 2003 18:14:24 +0000 |
| Subject: | Re: Re: [PHP] Addin a column of numbers not using MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-158173@lists.php.net to get a copy of this message | ||
----CODE Begin-----------------
$sql_2 = "SELECT SUM(paidamount) as paid
FROM $tb_name
WHERE id = \"$id\"
";
$result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($result_2)) {
$paid = $row['paid'];
}
----CODE End-----------------
What I want to do from here is add up all the 'paid' figures.
>
> From: Jason Wong <php-general@gremlins.biz>
> Date: 2003/08/04 Mon PM 01:55:40 EDT
> To: php-general@lists.php.net
> Subject: Re: [PHP] Addin a column of numbers not using MySQL
>
> On Tuesday 05 August 2003 01:21, Ben C. wrote:
> > I tried the code you provided below but it returned 0. Is there another
> > way I can do it?
>
> Please post your code.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> "Trust me. I know what I'm doing."
> -- Sledge Hammer
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>