save query result in a file and download it

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mansoorsheraz
    New Member
    • Sep 2006
    • 2

    save query result in a file and download it

    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.
  • bassamba
    New Member
    • Sep 2006
    • 7

    #2
    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="myfil e.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

    Comment

    Working...