qwerty234 Posted April 4, 2007 Share Posted April 4, 2007 Anybody see a problem with the way I'm triying to print these columns out using PEAR/Excel? $result is populated -- I made sure with print_r. $rows = 0; $cols = 0; $rows = mysql_num_rows ($result); $cols = mysql_num_fields ($result); $colNames = array(); for ($col = 0; $col < $cols; $col++) { $colNames[col] = mysql_field_name($result, $col); } // Add all the column headings with a single call // leaving a blank row to look nicer $sheet->writeRow(5,0,$colNames,$colHeadingFormat); $colHeadingFormat2 =& $xls->addFormat(); $colHeadingFormat2->setFontFamily('Helvetica'); $colHeadingFormat2->setSize('10'); $colHeadingFormat2->setAlign('center'); for ($row = 0; $row < $rows; $row++) { $rs = mysql_fetch_row ($result); for ($col = 0; $col < $cols; $col++) { $sheet->write($row+6,$col,$rs[$col],$colHeadingFormat2); } } Link to comment https://forums.phpfreaks.com/topic/45569-pear-excel-question/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.