implementing mysqli better