Wednesday, May 23, 2012

Re: Storing multidimensional Array into Database

On Wed, May 23, 2012 at 12:54 PM, teji infin <teji.infin@gmail.com> wrote:
> yes sir thing is the same bt actually in my code i get an array from
> somewhere else now that array data i have to insert it in database.

And what have you tried so far?

Assuming you have a Deadline model, you could try something like this
in your controller:

foreach($array['deadlines']['deadline'] as $deadline) {
$dl['date'] = $deadline['date'];
$dl['text'] = $deadline['text'];

$this->Deadline->create($dl);
$this->Deadline->save($dl);
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: