buildakicker Posted October 7, 2011 Share Posted October 7, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/248665-export-to-xls-php5-oracle/ Share on other sites More sharing options...
trq Posted October 7, 2011 Share Posted October 7, 2011 Have you tried simply echoing your database results first to see if the query itself is working? Quote Link to comment https://forums.phpfreaks.com/topic/248665-export-to-xls-php5-oracle/#findComment-1277107 Share on other sites More sharing options...
buildakicker Posted October 8, 2011 Author Share Posted October 8, 2011 Hi, I have echoed out the results and they show just fine. When the XLS file comes up, all I get is the geo_area field and 45 rows with 1-45 numbers in it. However, there should be multiple columns and rows... Quote Link to comment https://forums.phpfreaks.com/topic/248665-export-to-xls-php5-oracle/#findComment-1277261 Share on other sites More sharing options...
trq Posted October 8, 2011 Share Posted October 8, 2011 Then the problem would appear to be within your Spreadsheet_Excel_Writer code somewhere. Moving to a more appropriate board. Quote Link to comment https://forums.phpfreaks.com/topic/248665-export-to-xls-php5-oracle/#findComment-1277301 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.