Sum of Values in an Array


Posted on 16th Feb 2014 07:03 pm by admin

This is probably really simple... but it's been years since I've written anything, so bare with me!

I've got a MySQL database setup with a table that has multiple fields, where one is a numerical balance. I want to fetch all of these balances, add them together, and print a total.

This is what I have so far:

$acctTotal = mysql_query('SELECT bal FROM assets WHERE term = 'C'');
while($row = mysql_fetch_assoc($acctTotal)){
echo $row[bal];
}

No comments posted yet

Your Answer:

Login to answer
302 Like 15 Dislike
Previous forums Next forums
Other forums

Can we convert non uni code system into unicode
Hi All,

Presently i am using non-unicode system and the sap version is 4.7.
Can i c

private constructor
Hello,

Can we create a constructor as private? If yes, what is the use of it? If no, why can'

Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.

But

newbie question about multiple queries
hi everyone,
I'm sorry to ask such a basic question, but I'm young and trying to learn php on my

I need help on this PHP code
Hi everybody, I made some kind of mistake while editing the code below. As you see, at the 3 row my

problem with php mysql query
Hi guy's...

I'm totally lost here..because don't have any idea how to make a query for grab r

Creating a function
Basically i wanna put all this code in a seperate file

Code: <?php

Gerenate tabel in Php
I whant to generate a tabel takeing data from database like this one so the results to be display on

SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built

dinamic "textboxes"?
Ey all, my first post here, i hope its not a hard one

I display mysql results in a table

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash