|
Posted by Richard Lynch on 10/04/76 11:08
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
[Back to original message]
|