Hi can anyone help with this I would like to show a total at the end of the loop like a grand total.
Thanks
<?php
class Calculation2
{
// function for var
function QuoteEngine($var,$qty,$spec){
if($var){
global $total;
$this->varX = round($qty / $var,2);
$result = mysql_query("SELECT * FROM Specs
WHERE Hours >= \"$this->varX \"
ORDER BY Hours ASC
LIMIT 1");
$row = mysql_fetch_array($result);{
$this->varHr=$row[HandworkHr];
}
$this->varam=$this->varX * $this->varHr;
$this->varM=round(($this->varam/$qty)*1000,2);
echo"amount $this->varam <br>";
$total= $this->varam;
return ($total);
}
}
}
//other page
//get array from select from equipment table
include("../Include/dblib.inc");
$spec=array(HeidHr,HeidHr,GluerHr);
$var=array("2000","3000","4000");
$qty=array("3000","4000");
$obj1=new Calculation2();
for($i=0;$i<count($qty);$i++)
{
for($j=0;$j<count($spec);$j++)
{
$obj1->QuoteEngine("$var[$j]","$qty[$i]","$spec[$j]");
$total += $total[$j];
}
}
echo"Total $total <br>";