PHP script for connecting to MySql DB, formatting the data and Inserting into Postgres