Fetch Data From Database

hello i am new in yii.I want to validate the user after login in my actionLogin method i am getting my username, password, name and Id(primary key). I want to validate username, password and Id then to go into view user page.

following is my function. but i am having issue. plz guide me to solve this

public function actionLogin($id)
















You are not calling validate method, then how it will validate.

you have not mentioned what kind of problem are you facing?

Following sample code may help you

public function actionLogin()


		$model=new LoginForm;

		// if it is ajax validation request

		if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')


			echo CActiveForm::validate($model);



		// collect user input data




			// validate user input and redirect to the previous page if valid

			if($model->validate() && $model->login()) {

				//to get user id 


				//current time stamp

				$timestamp=date('Y-m-d H:i:s');

				//update last_login_time field in user table

			    User::model()->updateByPk($userid, array('last_login_time' =>$timestamp));





		// display the login form