update connection.php

added a class in the connection file to make the code more cleaner and organize.