[RESOLVED] Export oracle table to .CSV file in PHP
Results 1 to 3 of 3

Thread: [RESOLVED] Export oracle table to .CSV file in PHP

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Location
    Sri lanka
    Posts
    12

    resolved [RESOLVED] Export oracle table to .CSV file in PHP

    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);

    ?>

  2. #2
    Junior Member
    Join Date
    Jul 2013
    Location
    Sri lanka
    Posts
    12
    Is there any way to write oracle table to CSV file using php.?
    your help is appreciated.

    Thanks

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Location
    Sri lanka
    Posts
    12
    I SOLVED IT MYSELF....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •