I have made a session variable and had to update my code to change $connection to $_SESSION["connection"].