Class to interact with database securely in PHP