Taking Two Databases

Hi All,

I got error when the login name is not matched with data base

my code is

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

			//$this->redirect(Yii::app()->user->returnUrl);


			/**/


					$username=Yii::app()->user->name;


					//echo $username;


					$result = Yii::app()->db->createCommand()


						->select('clientid, role')


						->from('master.user')


						->where('username=:username', array(':username'=> $username))


						->queryRow();


					//$user = $result['username'];


					$clientid = $result['clientid'];


					$role = $result['role'];





			/**/


			if($role=='masteradmin')


			{


					$this->redirect(array("/user/admin"));


						


			}


			else if($role=='admin')


			{


				


				$this->redirect(array("/user/admin&User%5Bclientid%5D=$clientid"));


				


			}


			else if($role=='employee')


			{


				


				$this->redirect(array("/AshaVendorProfile"));


				


			}

am new for yii please help me …

am using two databases…