how to export data from database to csv file in php?
['Retrieve data from the MySQL database.', 'Create a file pointer using fopen() function.', 'Specify the header columns and put into the CSV file.', 'Output each row of the data, format line as CSV and write to file pointer.']