views:

34

answers:

1

Hello,

i have an array in $this->data that looks like this:

    Array
(
    [Boeking] => Array
        (
            [start] => 25/12/2010
            [end] => 26/12/2010
            [centrum] => Brussels
            [responsible] => Wouter
            [email] => [email protected]
            [materials] => Array
                (
                    [0] => 4
                    [1] => 5
                    [2] => 6
                    [3] => 8787
                    [4] => 5
                    [5] => 2572
                    [6] => 75
)
)
)

the fields in my DB are the same, so i have a table called 'boekings', with the fields 'start, end, centrum, responsible, email and materials'.

materials is a varchar(1000) so it should be long enough.

without CakePHP i used to do this with the serialize() function of php, but now i don't know the answer...

when i comment the line responsible for the materials array, it puts the data properly in my DB so there is no problem with my saveAll() method.

Thanx in advance guys!

Wouter

A: 

never mind got this working allready

http://cakeqs.org/eng/questions/view/how_do_i_put_this_data_in_my_db

thanx!

This is bad style, you should add a table Boeking_material which relate materials to the Boekings (whatever those are). Storing data serialized or comma seperated in databases might work but it _will_ bite you later (i.e. when you want to search for boekings with specific materials).
dbemerlin