Re: Write custom column names to query result file
- From: "NC" <nc@xxxxxxxxx>
- Date: 3 May 2005 09:07:44 -0700
Joe Gazda wrote:
>
> I'm a relative newbie to PHP, but have been able to put together some
PHP
> code to generate a CSV/XLS file from a Query result. Now, I would
like to
> include custom column names instead of the MySQL column table names.
I know
> that there are codes to generate tabs and carriage returns, but can't
find
> anything about including "commas" in a string to output to the file
to
> separate the custom field names.
Just replace "\t" with ",". That's it.
> I'd appreciate some help with a line of code to insert those custom
> column names like:
>
> First Name | Last Name | DOB | etc.
OK, right now you have:
> for ($i = 0; $i < $fields; $i++) {
> $header .= mysql_field_name($export, $i) . "\t";
> }
Just replace it with
$header = "First Name,Last Name,DOB,etc.";
Cheers,
NC
.
- Follow-Ups:
- Re: Write custom column names to query result file
- From: Joe Gazda
- Re: Write custom column names to query result file
- References:
- Write custom column names to query result file
- From: Joe Gazda
- Write custom column names to query result file
- Prev by Date: Re: index.php
- Next by Date: what's wrong with this MIME mail ?
- Previous by thread: Write custom column names to query result file
- Next by thread: Re: Write custom column names to query result file
- Index(es):
Relevant Pages
|