help with update of model

hello all, I’m a newcomer to yii and actually to php frameworks in general.

I found yii actually providing the solution to all my problems and now I’m applying it to my web application.

I already have a nice db structure, and at the moment I’m trying to make it work with simple tables that doesn’t require relations (actually the tutorial pushed me in the wrong direction and now I’m reading the documentation plain & simple).

So what’s happening is that I’ve got a table with only a primary key that is defined as varchar(20).

I managed to create the model and the crud templates for all the code, and actually I can insert new entries in the table (well I’ve struggled a little bit since I had to set the PK as safe), and I can even delete them.

The thing that it’s not working is the update, seems like the db isn’t updated (but actually the model->save() returns true, or at least it seems so) and then the redirect to the new entry show is showing a nice 404 page.

What’s wrong?

tell me if you need anything I can post it.

best regards,


[edit] if you want to see here’s the controller code

If I understand correctly you want to change the PK on update. I don’t know how to do it, but the discussion in this thread might shed some light:


that’s exactly what I needed! thank you very much, even if it’s a problem it’s a relief to know that what I understood since now is not that wrong :)