It is always a bad idea to try and squeeze lists into a single field.
It will inevitably lead to you pulling your hair out in the future.
Anyone who is tempted to store comma separated lists in a field
because its 'easier' should spend a few minutes reading about database
normalization. 
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
is a great place to start. Following a few simple 'rules' when
developing your tables will save you the headache of trying to write
overly complex SELECT queries in the future.

On Aug 6, 2:19 am, Rawna <[email protected]> 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!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to