You are here: Re: Parsing CSV-file and adding CSS to style « PHP Programming Language « IT news, forums, messages
Re: Parsing CSV-file and adding CSS to style

Posted by Rik on 06/24/06 13:03

Rik wrote:
> Seeing as you know the number of array-elements here, replace with:
> $rowhtml ='
> <tr>
> <td>%s</td>
> <td>%s</td>
> <td>%s</td>
> <td align="right">%s</td>
> </tr>';
> while(($row = fgetcsv($csvHandle, filesize($csvFile))) !== false){
> $this->html = vsprintf($rowhtml, $row);
> }

Or, if you don't know the number of array-elements, for future use:

$rowbegin ='
<tr>';
$rowbetweeen = '
<td>%s</td>';
$rowend = '
<td align="right">%s</td>
</tr>';
while(($row = fgetcsv($csvHandle, filesize($csvFile))) !== false){
$this->html =
vsprintf($rowbegin.str_repeat($rowbetween,count($row)-1).$rowend, $row);
}

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация