Replace old MySQL functions for PDO