$mileSQL51="SELECT * FROM t_temp5 where (card_id='$card_idM')&&(card_id!='')&&(card_id!='NULL') group by card_id" ;
//process the result
$mileresult51 = mysql_query($mileSQL51);
//check for errors on the result
if(!$mileresult51){
die("SQL Query ERROR! mileSQL51" . mysql_error()); // if the result is not a proper result then we output the error
}
while($milerow51 = mysql_fetch_array($mileresult51)){
//Set each line to a variable
//$idM5=$milerow5['id'];
$drive_dateM51 = $milerow51['drive_date'];
$emp_idM51 = $milerow51['emp_id'];
$card_idM51 = $milerow51['card_id'];
$acc_kmM51= $milerow51['acc_km'];
$last_acc1 = $month_kmM + $acc_kmM51;