Re: Sending the results of a query without using a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux