\n"; while ($line = mysql_fetch_row($result)) { $datetime=$line[0]; $fueladd=$line[1]; $realodo=$line[2]; $odo = ($realodo * 1.1); if ( $odo < "27000" ){ $odo = ($realodo * 1.06); } $full=$line[3]; $mileage="N/A"; if (($full != "Y")&&($lastodo != "0")) { $fuelsum = ($fueladd + $fuelsum); $mileage="N/A"; $miles="N/A"; echo "\n"; } else { $fuelsum = ($fueladd + $fuelsum); $miles = ($odo - $lastodo); $mileage = ($miles / $fuelsum); $lastodo = $odo; echo "\n"; $fuelsum = "0"; } } mysql_free_result($result); mysql_close($conn); ?>
DateAmount AddedOdo ReadingAdjusted OdoFull?Math?MPG since full
$datetime$fueladd$realodo$odo$full$miles / $fuelsum$mileage
$datetime$fueladd$realodo$odo$full$miles / $fuelsum",round($mileage, 2),"