Php script that scrap data from DB and output CSV files