change mysql functions to PDO