Switched over to PDO

changed all Database related stuff from mysql to pdo then merged and solved conflicts against latest master