Try this: if(!empty($this->data)) { foreach ($this->data["Tiposviajesusuario"] as $tipo) { $t["usuario_id"] = $u["id"]; $t["tipo_id"] = $tipo; $this->Tiposviajesusuario- >create(); $this->Tiposviajesusuario- >validates(); $this->Tiposviajesusuario- >save($t); $t = null; } }
I ran into a similar problem once. I was updating a meetings table, and I tried to do things like $this->data['Meeting']['date']. When I tried to save, I got errors. Changing it to $this->data['date'] fixed things for me. I hope that helps. hydra12 On Dec 3, 7:19 am, stefano <[EMAIL PROTECTED]> wrote: > Hello i'm using the las version of cakephp1.2 > > i have a problem with Model->save > > this is my source > --- > if(!empty($this->data)) { > foreach ($this->data["Tiposviajesusuario"] as $tipo) { > > $t["Tiposviajesusuario"]["usuario_id"] = $u["id"]; > $t["Tiposviajesusuario"]["tipo_id"] = > $tipo; > $this->Tiposviajesusuario->create(); > > $this->Tiposviajesusuario->validates(); > $this->Tiposviajesusuario->save($t); > $t = null; > } > } > ---- > > i got this error > > Notice (8): Undefined index: tiposviajesusuario [CORE\cake\libs\model > \model.php, line 1093] > Warning (2): array_key_exists() [function.array-key-exists]: The > second argument should be either an array or an object [CORE\cake\libs > \model\model.php, line 1 > Notice (8): Undefined index: tiposviajesusuario [CORE\cake\libs\model > \model.php, line 1099] > Warning (2): array_keys() [function.array-keys]: The first argument > should be an array [CORE\cake\libs\model\model.php, line 1099] > > and the pr($t); > > is > > Array > ( > [Tiposviajesusuario] => Array > ( > [usuario_id] => 1 > [tipo_id] => 1 > ) > > ) > > i need help pls :D --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---