RE: [PHP] Addin a column of numbers not using MySQL
| From: | Ben C. | Date: | Mon, 04 Aug 2003 07:59:11 +0000 |
| Subject: | RE: [PHP] Addin a column of numbers not using MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-158125@lists.php.net to get a copy of this message | ||
Yes. From there I want to add all the 'a' values together using PHP.
-----Original Message-----
From: Justin French [mailto:justin@indent.com.au]
Sent: Monday, August 04, 2003 12:40 AM
To: Ben C.
Cc: php-general@lists.php.net
Subject: Re: [PHP] Addin a column of numbers not using MySQL
Do you mean something like:
<?
$i = 0;
$sql = "SELECT a,b,c FROM foo";
$res = mysql_query($sql);
while($myrow = mysql_fetch_array($res))
{
$i++;
echo $i."<br />";
echo $myrow['a'] ."<br />";
echo $myrow['b'] ."<br />";
echo $myrow['c'] ."<br />";
}
?>
Justin
On Monday, August 4, 2003, at 05:34 PM, Ben C. wrote:
> How do I add a column of numbers generated through a MySQL query
> without
> using the SQL SUM() function? I have tried looking through the
> different
> documentation. I am probably missing something.
>
> Thanks,
>
> Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---
> [This E-mail scanned for viruses]
>
>