Page 1 of 1

How to store multidimensional array in database?

Posted: Tue Dec 08, 2009 4:57 am
by rahulephp
Hi there,

can you please help me?

i have data in array and i want to insert it in a single table.
structure of table and array to be store is shown below:

Please let me know how to store this array in database?

Database Structure:
Image

array-structure
Image

database-Browse
Image

Let me know any solution for this?
Thanks in anticipation

Re: How to store multidimensional array in database?

Posted: Tue Dec 08, 2009 11:18 am
by JNettles
I haven't actually tried but would JSON work on this?

Re: How to store multidimensional array in database?

Posted: Tue Dec 08, 2009 12:49 pm
by AbraCadaver
It would probably be easier and make more sense if you changed your form so that the arrays look like this:

Code: Select all

Array
(
    [0] => Array
        (
            [temp_property_name] => x
            [temp_property_add] => x
            // etc...
        )
        
    [1] => Array
        (
            [temp_property_name] => y
            [temp_property_add] => y
            // etc...
        )
 
)