Re: Dynamically Downloading Data

From: Date: Mon, 26 Aug 2002 22:30:49 +0000
Subject: Re: Dynamically Downloading Data
Groups: php.general 
Request: Send a blank email to php-general+get-114187@lists.php.net to get a copy of this message
>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

« previous php.general (#114187) next »