Hi Jay,
> while($row = mysql_fetch_object($result)){
> print("<td>" . $row->value . "</td>\n");
> print("<td>" . $row->another_value . "</td>\n");
> $value1 = $value1 + $row->value;
> $value2 = $value2 + $row->another_value;
> }
>
> Challenge; Can this be made as simple for rows too?
<thinking out loud :-)>
<?php
$rowTotals = array ();
while ($row = mysql_fetch_object($result)) {
$rowTotal = 0;
foreach ($row as $key=>$val)
$rowTotal += $val;
// display whatever is needed from $row
$rowTotals[] = $rowTotal; // or echo it out to the last column of the
table
}
?>
</tol>
I don't usually use mysql_fetch_object so I'm not sure if you can walk
through it with foreach() though...
Cheers
Jon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php