I have a query that works fine, and I'd like to (if possible) in the same swipe add the total of the values of one column to the $result. In other words, I want to select * from the db and to the result, also add the sum of the values in a particular column. I have this:
...where $sort is populated according to whatever link was clicked...it's either blank or DESC...and woot! it works...
$query = "SELECT * FROM $myTable $sort";
...so the result is sorted, then list()ed into $result->fields... which I've then assigned to $stuff as such:
Is is possible to add up the values of $etc for all the rows returned and also include that value in the result? Or do I have to do another query separately to grab the sum of the values of a column? This would be the desired result:
for (; !$result->EOF; $result->MoveNext())
list($this,$that,$etc) = $result->fields;
$stuff = array('this'=> $this, 'that'=>$that, 'etc'=>$etc)
Hopefully this crazy idea is explained well enough... I think I'm going about it in the wrong way, but any assistance would be great!
$stuff = array(