[thelist] Excel & PHP, Total Column
Jay Blanchard
jay.blanchard at niicommunications.com
Wed May 8 12:54:01 CDT 2002
Good afternoon group!
I have been outputting Excel workshhets from PHP and now comes the time when
some other stuff needs to be done with the output, such as summing a row of
numbers. In Excel you have to have this function in the cell where you want
the total to appear for a row;
=sum(b2:h2)
So, in PHP I need to increment the alphabet part (I don't know the number of
columns, so I must handle it in the code) so that I can do this;
<?
print("<td>=sum(b2:e2)</td>")
?>
Here is the track I am on;
$alpha = b;
$numeric = 2;
$alpha1 = $alpha
foreach($dbrow as $key=>$value){ <---counts number of fields from left to
right
print("<td>=sum($alpha$numeric:$alpha1$numeric)</td>");
$alpha1++;
}
print("</tr>\n");
}
but it ain't working. Thanks to all in advance!
Jay
More information about the thelist
mailing list