On Wed, May 2, 2007 2:17 am, Todd Cary wrote:
> Some shared servers do not allow the creation of a file, so I am
> looking for a way to take the results of a query (MySQL), create
> a CSV output and have it in a sendable format for the user
> without creating a file.


$result = mysql_query("select * from something");

$output = fopen('php://output', 'w') or die("I messed up the php://
bit");

header("Content-type: application/octet-stream"); //force download
while ($row = mysql_fetch_row($result)){
  fputcsv($output, $row);
}

//Look ma, no file!

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to