How to sum two columns and get this value to insert in mysql

Topics: Developer Forum
Jan 31, 2013 at 9:14 PM
i have 2 columns "t" and "u" and i need to sum this columns to get a value for insert in mysql.

someone to helpme please.
Feb 1, 2013 at 1:00 PM
Iterate each cells and sum values
$Cols=array('U', 'T');
$Total=0;
$F=$objPHPExcel->getActiveSheet();//$objPHPExcel is your complete Excel file, see the numerous examples if you have trouble with this.
foreach($Cols as $aCol){
$i=1;
while(!is_null($F->getCell($aCol.$i)->getValue())){
if($F->getCell($aCol.$i)->getDataType()==PHPExcel_Cell_DataType::TYPE_NUMERIC)
$Total+=$F->getCell($aCol.$i)->getValue();
$i++;
}
}