Jump to content

PEAR Excel question


qwerty234

Recommended Posts

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

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.