PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 4th, 2007, 02:52 PM
qwerty234 qwerty234 is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 5 qwerty234 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 6 sec
Reputation Power: 0
Iterating over columns

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.


php Code:
Original - php Code
  1.  
  2. $rows = 0;
  3.        $cols = 0;
  4.        $rows = mysql_num_rows ($result);
  5.        $cols = mysql_num_fields ($result);
  6.  
  7.         $colNames = array();
  8.  
  9.         for ($col = 0; $col < $cols; $col++)
  10.         {
  11.         $colNames[col] = mysql_field_name($result, $col);
  12.      }
  13.  
  14.      // Add all the column headings with a single call
  15.      $sheet->writeRow(5,0,$colNames,$colHeadingFormat);
  16.  
  17.      $colHeadingFormat2 =& $xls->addFormat();
  18.      $colHeadingFormat2->setFontFamily('Helvetica');
  19.      $colHeadingFormat2->setSize('10');
  20.      $colHeadingFormat2->setAlign('center');
  21.  
  22.         for ($row = 0; $row < $rows; $row++)
  23.         {
  24.               $rs = mysql_fetch_row ($result);
  25.         for ($col = 0; $col < $cols; $col++)
  26.         {
  27.                 $sheet->write($row+6,$col,$rs[$col],$colHeadingFormat2);
  28.               }
  29.         }


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Iterating over columns


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT