To make it download, use header to set your content type:
header(Content-type: text/tab-separated-values\n\n);
Make sure the above is the first this the script outputs, and the only other
thing it outputs is data.
Take your code that spits out the data in html, strip out all the html, then
separate the values with a tab (\t), and a carriage return at the end.
So, while looping through the results:
print $db_1\t$db_2\t$db_3\r;
That gives you tab separated data, with one row per line.
HTH,
Peter Janett
~~ New Media One Web Services ~~
Web Hosting for Web Developers
New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.0.6, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43
PostgreSQL coming soon!
http://www.newmediaone.net
[EMAIL PROTECTED]
(303)828-9882
- Original Message -
From: Phillip S. Baker [EMAIL PROTECTED]
To: PHP Email List [EMAIL PROTECTED]
Sent: Thursday, February 07, 2002 2:54 PM
Subject: Re: [PHP] RE: Creating Tab-Delimited Text File
At 01:42 PM 2/7/2002, Andrew Chase wrote:
Which part are you having trouble with, specifically? The task as you've
described it is very straightforward, almost pseudo-code. :)
-Andy
I know very well how to do the Db query and then loop through the results
to display the info on an HTML page.
However I have not done the part about actually creating a new file in the
text format make sure the results are tab-delimited and then make it
available for download.
Can you help me with that part specifically?
Thanks
Phillip
-Original Message-
From: Phillip S. Baker [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 12:32 PM
To: PHP Email List
Subject: Creating Tab-Delimited Text File
Greetings All,
What I want to do is create a tab-delimited text file for download
from
records in a database.
I am not sure on how to do this.
So what I want to do is as follows.
ON a page a button is clicked.
Script is activated that pulls records from a database.
From these records a tab-delimited text file is created.
A save dialogue box appears so the user to save the text file to
his harddrive.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Blessings
Phillip
Those who give up essential liberty for a little safety,
deserve neither liberty nor safety.
- Ben Franklin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php