How And Where To Use And Place Sql Query In Yii

I am new to yii. I am currently working on a yii project in which I want that when a user is logged in, and then submit there items, then how to show and manage that users there own items. not of other users.

Please anyone help me that how to use this kind of SQL query and where to place this query, i.e. either in controller or model or view ? ? ? ? ?

Hi,

your requirement is easy to achieve, when u read yii development book. There is an example for doing this kind of stuff :)