mysqli code refactor

another method to handle escaping characters