Updated database connection mechanism to avoid deprecated PHP functions.