I am new to yii and I’m having touble using the save() command. As the description states, I am getting duplicate entries of what I am saving in my database. This is the code I am running
$member = new Member(); $member->FirstName=$model->FirstName; //jack $member->MiddleName=$model->MiddleName; $member->LastName=$model->LastName; //smith $member->SecondLastName=$model->SecondLastName; $member->Gender=$model->Gender; //m $member->UserName=$model->UserName; //jackSmith $member->Password=$model->Password; //somePassword $member->DateJoined=new CDbExpression('NOW()'); //today's date $member->save();
after this runs, my database has
| ID | FirstName | MiddleName | LastName | SecondLastName | Gender | UserName | Password | DateJoined | DateLeft
| 10000016 | jack | | smith | | M | jackSmith | somePassword | 2012-02-14 | NULL
| 10000015 | jack | | smith | | M | jackSmith | somePassword | 2012-02-14 | NULL
any ideas why this is happening?