Insert Users And Fetch

hi.,

i need to insert the logged in user into database and i have one more option in operation that my products, when user click that option it should show the products added by him using db(username)… plz help me to achieve this.,

first you need to setup the useridentity, then you will get the user id as


Yii::app()->user->id

ya got that and its inserting username also but the problem getting is., its inserting 2 rows, 1st row with username only and second row with created details. so here id is incrementing twice… how to resolve this…?? my id attribute is auto increment.,but here incrementing twice… can anybody plzzzzzzzzzzzzzzz help me…??? wts d issue here…??

how u are saving the user ?

u are saving twice!! thats y this problem

hi

i have ‘create’ button here and if i click., it should save all the contents with session user name.,

Could you post the controller/action and model code?

session !! not required!!

use Yii::app()->user->id, then if you want to save the details to the same user entry,then load that model and save it. dont create new instance