Sql Query On Login

I am a newbie to yii. So far i have setup yii with three controllers (employees, branches and site (default)). I made some customisation to the views but that all code was generated with gii and i customised it. i have also setup rights extension and yiistrap and yiwheels.

I want to execute a query like this.

select branch_id from tbl_user where username = $_POST[‘username’] and password = $_POST[‘password’]

$_POST[‘username’] and $_POST[‘password’] are the login details user provided. I want to list all the branch_id(s). How can i use the above code in yii?

Looks like you haven’t read yii guide yet : http://www.yiiframework.com/doc/guide/1.1/en/database.overview (which is highly advisable), have you?

Thanks! Its a great resource. I am going through the documentation now.

Can you guide me regarding the area where the query needs to be performed? Shall i override the actionLogin() in the site controller?

Yes please read the guide first.

If you want to least branches, you may call this query at any controller (probably making a call to a model) you need to.

Though if you’re just starting to study Yii and don’t have to use the first version of the framework, I suppose you may start studying Yii 2.