Update PHP code to access database