If i uncomment below array, those data will be export to the csv file. but how do i export the data on 'timedata' table to the CSV file.

help me.

/*$list = array (
array('hhh', 'mmmm'),
array('12883', '458886')

);*/

This my complete php code,

<?php

//connecting to oracle

$connect = odbc_connect("oraclesrc", "xe", "sec123");
$query = "select * from timedata";
$result = odbc_exec($connect, $query);
$numOF = 0;

while(odbc_fetch_row($result))
{

$emp = odbc_result($result, 1);
$time = odbc_result($result, 2);
$numOF++;

echo $emp; 
echo $time;   

}

/*
$list = array (
array('hhh', 'mmmm'),
array('12883', '458886')

);
*/

$fp = fopen('testfile.csv', 'w');
foreach ($list as $fields)
{
fputcsv($fp, $fields);
}
fclose($fp);

odbc_close($connect);

?>

    Is there any way to write oracle table to CSV file using php.?
    your help is appreciated.

    Thanks

      6 years later
      Write a Reply...