Example to insert the rank system: echo getRank($userdata['user_id']); The function only need the user_id to show the rank ( getRank(USER_ID) )