before each save use create $this->ModelName->create(); $this->ModelName->save($data);
see the section in the manual on saving data http://book.cakephp.org/view/75/saving-your-data sam d -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ On Thu, Jul 3, 2008 at 10:38 AM, KiANIi <[EMAIL PROTECTED]> wrote: > > Hi, > I'm trying to save data using $this->modelName->save(data) in a loop > but after the end of each iteration when I'm trying to find the data > that I've inserted I could not find that data. > > Can anyone tell me how i can save data in table in loop. > > the code is: > > $this-model = $this->controller->modelName; > for ($i =0 ; $i<4;$i++) > { > echo 'Iteration # '.$i; > $this->model->save($distributedImp); > $res = $this->model->findAll(); > print_r($res); > } > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---