MySQL functions changed to PDO methods