Reply to Re: excel exporter

Your name:

Reply:


Posted by Colin Fine on 10/07/06 17:05

toffee wrote:
> Hi all,
>
> i have several php files which each run a different SELECT query and
> displays the data in a table. I would like to create an option to export the
> table to excel and one route i would like to go down is creating a single
> export.php file with an excel header; and basically it would read the sql
> query stored in a session; and just create a spreadsheet from the results.
> the problem is each query yields a different number of columns, so what php
> code would tell it to select all fields for every row rather than specifying
> each field one by one?
>
> I hope this makes sense to you.
>
> Kind regards
>
> T
>
>

Assuming you're using MySQL,
mysql_fetch_row returns a row as an enumerated array
mysql_fetch_array returns an enumerated or associative array
mysql_fetch_object returns an object.

In each case, you do not need to know in advance how many fields will be
returned. And if you use the associative array or the object you can get
at the names of the fields as well.

Does this answer your question?

Colin

[Back to original 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

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