adding database information using php
ok... I am not a programmer... ( i am self taught.. i working with Php) i have data , numbers to be exact in a mysql database
i can pull the data out, but what i want to know is how can i get each data to be added to the next and then displayed as a sum
extract:
//query database
$gas_b = "Select number from $dbase_table3";
$gas_b_q = mysql_query($gas_b);
//pull data
$inc=0;
while ($row = mysql_fetch_array($gas_b_q)) {
$bought = $row["amount_bought"];
}
$result[$inc]=$bought;
$inc++;
and to display it as a list
extract:
for ($k = 0; $k <= count($result); $k++) {
echo $result[$k];}
this what i have.. (what i use to pull out data and display as list) anyway.. i want to take number out and add them together and display only the sum
how would i change this script to instead of listing i could just add them together
and then just print the sum..
some Help
Why fight Information Technology when you can outsource IT