function to update many rows at once