By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

save query result in a file and download it

P: 2
Hi there,
I am, doing a project in which i need the user to have his account history downloaded. I am, doing this project in PHP and mysql. There is a link on the account history page which reads "Download your account history". The accoutn history has to be fetched from the database tables and then downloaded by the user. I dont know how to do this. This functionality is similar to what we have normally on the mobile phone sites where a user can download his call history as a file. Please help me in this regard as its really very urgent.
Regards.
Sep 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: 7
hello,
you can do the following:

for example, you can save the file as XML and download it:

filename:[generate.php?id=username]:
<?php
header('Content-Disposition: attachment; filename="myfile.xml"');
header('Content-Type: text/xml');

echo 'dummy text'.$_GET['id'];

?>

and user will see a download pop-up screen with the file name appearing as "myfile.xml".

-bassam
Sep 28 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.