Hi all,
strange thing I run an oracle sql query without errors (all error reporting is on):
SELECT
V_FLIGHTS.FLT_COM_DEP_BLK AS DOF,
V_FLIGHTS.lfc_id AS OPERATOR,
V_FLIGHTS.Flt_number AS FLT,
V_FLIGHTS.Flt_apt_iata_code_dep AS DEP,
TO_CHAR(V_FLIGHTS.Flt_crep_db , 'HH24:MI') AS OFFBLOCK,
TO_CHAR(V_FLIGHTS.Flt_crep_dt , 'HH24:MI') AS TAKEOFF,
TO_CHAR(V_FLIGHTS.Flt_crep_al , 'HH24:MI') AS LANDING,
TO_CHAR(V_FLIGHTS.Flt_crep_ab , 'HH24:MI') AS ONBLOCK,
V_FLIGHTS.Flt_apt_iata_code_arr AS ARR,
FFL_AMOUNT_2 AS FOBBF,
FFL_AMOUNT_3 AS FOBAF,
FFL_AMOUNT_4 AS OFFBLOCK,
FFL_AMOUNT_13 AS ONBLOCK,
FFL_AMOUNT_9 AS TRIP,
V_FUEL_UPLIFTS.fup_uplift AS UPLIFTINLITRES,
V_FUEL_UPLIFTS.fup_density AS SG
FROM Master.v_Flights
LEFT JOIN MASTER.V_FUEL_UPLIFTS
ON MASTER.V_FUEL_UPLIFTS.Fup_FLT_ID = MASTER.V_FLIGHTS.FLT_ID
,TABLE(master.p_fuel_flights.home(flt_id))
WHERE
LFS_LABEL ='Operated'
AND master.v_flights.lfc_id = '$opr'
AND TRUNC(master.v_flights.flt_com_dep_blk) BETWEEN '$fromdate2' AND '$todate2'
ORDER BY DOF, TO_CHAR(V_FLIGHTS.FLT_COM_DEP_BLK, 'HH24:MI')
Then i use fwrite to drop it into a csv file as follows:
<?php
$myfile = fopen("acmi.csv","w") or die("unable to open file");
fwrite($myfile,"dof,operator,flight,dep,offblock,takeoff,landing,onblock,arr,FOBBF,FOBAF,OFFBLOCK,ONBLOCK,TRIP,UPLIFT,SG\n");
while ($row = oci_fetch_array($query))
{
fwrite($myfile,$row[0].','.$row[1].','. $row[2].','. $row[3].','. $row[4].','. $row[5].','. $row[6].','. $row[7]. ','. $row[8].','. $row[9].','. $row[10].','. $row[11].','. $row[12].','. $row[13].','. $row[14].','. $row[15]."\n");
}
oci_free_statement($query);
oci_close($conn);
fclose($myfile);
?>
The CSV is generated however only row1,2,3,4 and 9 have data present, strangely enough
all the missing fields are numeric or time values.
What could this be, suggestions anyone?
thanks,
Yannick