Fixed mysqli errors and tested. Mysqli functions were missing connection parameter.