>Is it possible to select data from a database and have it be available for
>download without actually creating a file on the server?

Yes, of course :-)

Here is a tab-delimited file of upcoming events from 'whatever' table:

<?php
  require 'connect.inc';
  
  $query = "select * from whatever where whatdate >= now()";
  $upcoming = mysql_query($query, $connection) or error_log(mysql_error());
  while ($row = mysql_fetch_row($upcoming)){
    echo implode("\t", $row), "\n";
  }
?>

You may or may not want to add something like:

header("Content-type: application/octet-stream");

to force a download, as well as review the posts of the past few days (and
seemingly every week or so for the past 5 years) about how to force the
browsers to pick a "nice" filename for the "Save As..." box.

-- 
Like Music?  http://l-i-e.com/artists.htm


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

Reply via email to