You can not store array(); in the database.You have to separate the array
elements using implode function & then you can add it to the data base.

Better way please create new table that will take the book_id & the
auther_id so that you can associate the models.

On Thu, Aug 6, 2009 at 2:49 PM, Rawna <asumaw...@gmail.com> wrote:

>
> How do I store an array into the database?
> Here's the view:
>                echo $form->input('name');
>                echo $form->input('bio');
>                echo $form->input('book_id', array('multiple' => true));
>
> What if I got multiple books? How do I store them in the database?
> Whenever I tried saving the entry I get these errors:
>
> Notice (8): Array to string conversion
> Warning (512): SQL Error: 1054: Unknown column 'Array' in 'field list'
> Query: INSERT INTO `authors` (`name`, `bio`, `book_id`) VALUES ('Chuck
> Palahniuk', 'Great writer', Array)
>
> I created the BookController using bake BTW.
>
>
> Thanks in advance!
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~---------~--~----~------------~-------~--~----~
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