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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.