Re: Delete a file immediately after download
| From: | Richard Lynch | Date: | Wed, 16 Feb 2005 00:34:36 +0000 |
| Subject: | Re: Delete a file immediately after download | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-208796@lists.php.net to get a copy of this message | ||
Shaun wrote:
> Hi Marek,
>
> Thanks for your reply, could you tell me how I would go about this please?
<?php
require 'connect.inc';
$query = "select * from whatever";
$data = mysql_query($query);
while ($row = mysql_fetch_row($data)){
echo implode("\t", $data), "\n";
}
?>
You can muck around with CSV if you prefer, but tab-delimited is way
easier, assuming no tabs in your content.
This also assumes no newlines in your content.
If there are tabs and/or newlines in your content, you can use MySQL's
replace function (not the REPLACE INTO, but the string function 'replace')
to change tab to, err, \\t or something, and newline to Mac
carriage-return or something.
You'd have to do this (and more) to get CSV working right.
The on-line manual has example code for CSV at http://php.net/fputcsv
Maybe you should have googled before posting, eh?
--
Like Music?
http://l-i-e.com/artists.htm