Changed mysql calls (deprecated library) to mysqli