Changed all depreciated mysql functions to updated mysqli functions