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];
}

302 Like 15 Dislike
Previous php-forum Next php-forum
Other php-forum

Displaying image pathname instead of image
Hello

Im trying to upload and then display images from a mysql database - Its only basic and

Adding delete feature to my forum
Hello I am currently trying to add a delete feature to my forum. I believe I have everything built r

If a record matches an existing record do nothing
So I don't know if I should put this here or in mysql, but what my script is for is for people to ad

Are sessions secure at all?..
I haven't really gotten into yet, but I was just thinking of something weird..

Lets say you h

Please Help my PHP Dating Function.
Hi everyone!

Well here is my code that displays this:

It works wonderful.


question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.

I hav

DateTimeZone::listIdentifiers headache
http://php.net/manual/en/datetimezone.listidentifiers.php


So the documentation states tha

Cant display mysql data
Hey all,

I am learning php and my first goal is to create a simple CMS. At the moment I am st

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

Line break?
Hi, I'm new to the forum and new to php. I'm not sure if I'm using the correct terminology so here i

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