Hi All,
I was wondering how it was possible to total values from a query... I was thinking that I could do the math at the MySQL level, but I actually am taking results from a DB and a WebPage and doing further calculations on them. Allow me to explain...
I'm building a simple portfilio app to track stocks... I get the purchase price from the db, then pull the current price from yahoo's financial pages. Multiply each amount (sepreratley) by the number of stocks they own. that gives me the current value, and the difference (profit / loss) value.
I then use a loop to loop each row out, so that each stock has it's own table row.
What I need now, is to be able to have the prices add up during the loop, and set that to a total variable(s) - then, after the loop is finished, out put the total variable(s) in the last 'static' row. I need to do this on 3 seperate columns - all being calc'd after the query pulls down, so i need a PHP method.
please provide a simple example, i can modify it to fit my needs.
Thanks so much!