Hi all,
I am stuck on a problem and I can certainly do with some help.
I want to create an array with the values of one field from a mysql database
and then add all of it up.

 if ($numrows>0) {
          $i=0;
  while ($list = mysql_fetch_array($result))

          $total[$i]=($list["price"]*$list["qty"]);

echo "<TD class=\"normal\"> ".$total[$i]."</TD>";

++$i;
  }
$a=array($total[0],$total[1]);

echo "Total =  ".array_sum($a)."\n";

  }

 if I put the indexes manualy as 0,1,2 as above it works fine , my problem
is that I am trying to create an array with all the values,

I tried using

$a=array($total[range(0,$i)]);

but it gives me an ILLEGAL Offset Type.

What am I doing wrong?

Can anybody help. Please??????

Thanks in advance,

Cami


Reply via email to