Im trying to figure out a way to add up all the fields extracted from one column in a database and get the total. I can get the array however, the code to have it dynamically add all the field values and return a total is a bit beyond me at this point. The number of fields will increase by one every month so I need the script to be able to extract the fields and add them on its own without me having to hard code in field[0]+field[1] every month. Anybody have any ideas?
Thanks guys.
Have a query which does this :
$query = "select sum(column_name) from table_name" $result = mysql_query($query); $row = mysql_fetch_row($result); $total = $row[0]; print($total);
Hope I understood your question properly reg kevin
Ok, cool... Thanks Kevin. Ill give that a try.