Recoded all MySQL related functions to make use of the PDO system.