a logic i can't figured out yet

i have two tables

user and profile

user id is passed to profile as user_id

i want the profile to be loaded/edited according to the user_id not with the profile id how to do that can anyone tell me?

let say i have profile id = 17 and the user_id =16

and there is no record of profile 16 in the profiles table then

by default when the profile is viewed or edited an id is passed to it in this case it is 16 cos it’s the current user’s id but i want to check that if this id is matched with the user_id in the profile and if it does load that user profile don’t load on the base of whatever id profile has any idea???

done it by using the find method B)

public function loadModel($id)




			throw new CHttpException(404,'The requested page does not exist.');

		return $model;