Hi, in my edit method, sometimes i need to update my fields and
sometimes i need to add new ones. I´m trying to use $this->myModel-
>create() to reset the fields when i need to insert a new row, but
nothing happens, i always get the last ID updated... so the foreach is
updating the last row updated instead of adding a new row. This is a
fragment of my code:

$i=0;
$parameternameIDS = split(',',$this->data['Protocol']['paramIDS']); //
i get from the view
the
ids that  i want to update
foreach($this->data['Paramsname'] as $pn){
        if(empty($parameternameIDS[$i])){
            $this->Parametername->create();
        if(!empty($parameternameIDS[$i])){
           $this->data['Parametername']['ParameternameID'] = $parameternameIDS
[$i];}
           $this->data['Parametername']['Name'] = $pn;
           $this->data['Parametername']['ProtocolID'] = $this->Protocol->id;
           $i +=1;
if($this->Parametername->save($this->data['Parametername']))

any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to