totals from a mysql query
| From: | Andras Kende | Date: | Fri, 22 Jun 2001 01:18:37 +0000 |
| Subject: | totals from a mysql query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54834@lists.php.net to get a copy of this message | ||
Hello,
I have a php page which pull data from myusql database...
I'm new to php so I looking for some advice ...
I have a field which contains numbers and needed to have them totaled after
the query below the table...
Database:
|text1|text2|total|
|some|tfdfd|100|
|string|adfa|250|
|made|tofd|150|
total should be : 100+250+150
Query:
{$aresult=mysql_query("select * from testdb ,$db);}
while($amyrow = mysql_fetch_array($aresult))
{
echo "<Tr><td>";
{echo $amyrow["text1"];}
echo "</td><td>";
{echo $amyrow["text2"];}
echo "</td>";
}
echo "</td></tr></table>";
echo "all together : total";
total is : 500
Thanks,
Andras Kende