xionhack Posted April 15, 2009 Share Posted April 15, 2009 Hello. I have a website done in php. I want to have a hyperlink that when the user clicks on it will download a csv file that would be created in that moment. I've looked in different forums and in the php manual but havent been able to do it. Can somebody help? Thanks! Link to comment https://forums.phpfreaks.com/topic/154259-download-csv-from-php/ Share on other sites More sharing options...
schilly Posted April 15, 2009 Share Posted April 15, 2009 csv of what? Link to comment https://forums.phpfreaks.com/topic/154259-download-csv-from-php/#findComment-810979 Share on other sites More sharing options...
xionhack Posted April 15, 2009 Author Share Posted April 15, 2009 It would be a csv brought from fields from the mysql database Link to comment https://forums.phpfreaks.com/topic/154259-download-csv-from-php/#findComment-810983 Share on other sites More sharing options...
schilly Posted April 15, 2009 Share Posted April 15, 2009 grab your data from the db, format how you want it and write it to a file then set the headers to download the file. file download example here: http://www.higherpass.com/php/Tutorials/File-Download-Security/ you should be able to do it without writing the data to a file but i can't remember how off hand. Link to comment https://forums.phpfreaks.com/topic/154259-download-csv-from-php/#findComment-810991 Share on other sites More sharing options...
Mchl Posted April 15, 2009 Share Posted April 15, 2009 you should be able to do it without writing the data to a file but i can't remember how off hand. header implode echo should do the trick Link to comment https://forums.phpfreaks.com/topic/154259-download-csv-from-php/#findComment-811000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.