Get Id In Url And Save It In A Variable

i have a button on my Cgrid that serves as an update button, when i click it, It sends me to my with the following url:

http://localhost/AddressBook/addBook/index.php?r=account/update&id=1

Is there a way I can get the number of the id in my URL, so that I can use it in my update form?

Or is there another approach for updating a record using CFormModel

here is my button on CGrid:

array(

        'class'=>'CButtonColumn',


        'template'=>'{update}',


        'header'=>'Action',


        'buttons'=>array(


        'update'=>array(


        'url'=>'Yii::app()->createUrl(\'account/update\', array(\'id\'=>$data[\'AID\']))',


            ),


            ),


    ),

Just use $id, provided that the model function has id as a parameter.

Yii does some magic behind the scenes.

Your existing url would work if your action looks like this:


public function actionUpdate($id) {

    ...

}

You could also use this:


$id = Yii::app()->request->getQuery('id');

Or plain PHP:


$id = $_GET['id'];

oh wow, it works, Thank You very much