Thanks again

Haha...
I make it!
I use the model->db->update method:

first I construct parmaters for 'update',
$fields=array();
                        foreach (($this->params['data']['audit']) as $k => $v)
//$this->params['data']['audit'] is the post form data for table
'audit'
            {
                                if ($this->audit->hasField($k) && 
!array_key_exists($k,
$fields))//use model->hasField to check fileds,
                                {
                                        $fields[] = $k;
          //the fields saved
                                        $values[] = htmlspecialchars($v);
//
                                }

            }
                        $this->audit->setId($_POST["oid"]);//$_POST["oid"] is 
the origin
PK's value.
                        
if($this->audit->hasAny($this->audit->primaryKey."='".$this->audit->id."'")){//if
the PK value is exists in database
                            if($this->audit->db->update($this->audit, $fields, 
$values)){
                                $this->set("ajaxsubscr","<script 
language=\"javascript\">new
Ajax.Updater('ajax_update','/audit/index'+qstr+'',
{onComplete:function(request){Effect.Fade('".$this->action."_audit');stripe();initDrag();},asynchronous:true,evalScripts:true});</script>");//ajax
update,update audit list
                            }
                                                }
                        $this->render('posterror');     //do something


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to