Jump to content

Export to XLS PHP5 Oracle


buildakicker

Recommended Posts

I have a simple question I thought... but I am not able to get it to work.

 

I have an oracle select statement:

 

select geo_area, oct_projects, oct_work_perf from metrics_parea_geo_trends Order by geo_area

It works fine with SLQ+, so I know it's a good statement. When I try to export it to an excel spreadsheet using Spreadsheet_Excel_Writer() I get only the first field, geo_area and the total rows returned in the first column. This was working no problem on php4, however, we moved to php5 and now there is this issue.

 

$select ="select ".$spiece." from metrics_parea_geo_trends Order by geo_area";
        //THIS WORKS in SQL PLUS:   select geo_area, oct_projects, oct_work_perf from metrics_parea_geo_trends Order by geo_area;
        $trends = $DB->select($con,$select);
        $DB->logOff($con);


        $fname = tempnam("/tmp", "Geographic_Area_Trend.xls");
        $xls = & new Spreadsheet_Excel_Writer($fname);
        $xls->send("Geographic_Area_Trend.xls");
        $sheet = & $xls->addWorksheet('Binary Count');

        // Write some numbers
        for ( $i=0;$i<11;$i++ ) {
         // Use PHP's decbin() function to convert integer to binary
         $sheet->write($i,0,decbin($i));
        }

        // Finish the spreadsheet, dumping it to the browser
        $xls->close();

I have tried other simple export to xls, but nothing is working. I am stumped! Any clues?

Link to comment
https://forums.phpfreaks.com/topic/248665-export-to-xls-php5-oracle/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.