If you are setting up a true relational database, arrays would be stored in
a seperate table with a unique key.  Each part of the array would be a
seperate row.  This is called normalization.  If you are doing it for fun,
then you could place some type of seperator (like a comma, semicolon, etc)
between each array field.

Here is an example:
        FATHER TABLE:
                COLUMNS:        FIRST_NAME
                                LAST_NAME
                                AGE

A father can have many children which would be your array.  An Array is
really a repeating group of information.
        CHILD TABLE:
                COLUMNS:        FATHER_FIRST_NAME
                                FATHER_LAST_NAME
                                CHILD_FIRST_NAME
                                CHILD_LAST_NAME
                                CHILD_TITLE

Your tables could have the following information:
        FATHER TABLE:
        FIRST_NAME                      LAST_NAME                       AGE
        john                            doe                             39
        sam                             green                           44

        CHILD TABLE:
        FATHER_FIRST_NAME               FATHER_LAST_NAME        CHILD_FIRST_NAME       
 CHILD_LAST_NAME TITLE
        john                            doe                     robert          doe    
                 [spaces]
        john                            doe                     jennifer               
 doe                     [spaces]
        john                            doe                     sam                    
 doe                     [spaces]
        sam                             green                   sam                    
 green                   jr
        sam                             green                   kelly                  
 green                   [spaces]

The index on the child table would be every column to make it unique.  If
you want to select each child for john doe, your query would look like this:
                select child_first_name,child_last_name_title from child where
                        father_frist_name = 'john' and father_last_name = 'doe';

This is a very simiplified example.  You would need to taylor it for your
own needs.

-----Original Message-----
From: Jeroen van Bussel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:43
To: [EMAIL PROTECTED]
Subject: [PHP-DB] store an array in a mysqldb


I would like to know if it is somehow possible to store an array in a mysql
DB.

Could somebody please help me.

greetz Jeroen



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to