using mysqli custom method to fetch query output