debug mode log support added
changed date formate in log to use it in csv
moved all mysql_query call to execute_query to log all the queries executed for debuging