Hi All,
I am parsing data returned from a field that looks like this; 6-8-3-5-10-9-6__7-5-9--etc... The code below parses out the data they way I want it but only returns the first row. I need to compare all rows and return an average from each of the parsed out numbers. Where have I made a mistake? $i = 0; $total = array(); while($row = mssql_fetch_array($result)){ $thearray = explode('__', $row[$i]); $n = 0; foreach($thearray as $topelement){ foreach(explode('--', $topelement) as $element){ if(is_numeric($element)) { $total[$n] += $element; echo $element; $n++; } } $i++; } $avg = array(); $num = count($total); for($x = 0; $num > $x; $x++) { $avg[] = $total[$x] / $i; echo "<br>"; echo $avg[$x]; } } Thanks, alex hogan ****************************************************************** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ******************************************************************