Update Record Changed


I have some problem,

if I have not made any changes during the update process in a form,how can i display the alert message like "No Records Modified" and further the update process should be restricted without entering into the database.

any solution … ?


please see the post i hope it’s some help…


Hi Ankit,

     Thx for ur reply,actually my problem is,

     when i submit the Form,if there are no changes made in the form controls it should not be updated in the Database again,it should display a message using flash like "No Records Modified"if I have made changes in the form controls then it should display "Values Updated Successfully" and the values changed should be updated in the database respectively.


if you want to not change any data update query return 0 and if we change the data

update return 1 so you can redirect to any page

for exmple…

if($update != 0){

    //update query 


    //redirect code..


I’m afraid this cannot be done with vanilla Yii 1.1, as Yii doesn’t keep track on which attributes got changed. I worked on a concept for dirty (i.e. changed) attributes for Yii 1.1 more than a year ago. You can build upon that by extending CActiveRecord and create a new validation rule that checks for altered attributes.