All pastes #747198 Raw Edit

Anonymous

public php v1 · immutable
·published 2007-10-23 20:34 UTC
rendered paste body
<?phpini_set(  'include_path',  ini_get( 'include_path' ) . PATH_SEPARATOR . "pear/php");$database = "";$database_host = "";$database_username = "";$database_password = "";require_once "Spreadsheet/Excel/Writer.php";// Create an instance $xls =& new Spreadsheet_Excel_Writer();// Send HTTP headers to tell the browser what's coming$xls->send("filename.xls");// Add a worksheet to the file, returning an object to add data to$sheet =& $xls->addWorksheet('Worksheet Name');$tabledata = get_table_data("table");$i=0;foreach($tabledata as $table) {        $sheet->write(0, $i, $table['name']);        $i++;}$result = sqlquery("SELECT * from table");$data = get_result($result);$i=1;foreach($data as $d) {        $j=0;        foreach($tabledata as $table) {                $sheet->write($i, $j, $d[$table['name']]);                $j++;        }        $i++;}// Finish the spreadsheet, dumping it to the browser$xls->close();?>