php script to export data to sql database