Page 1 of 1

Help me in this array

Posted: Tue Jul 06, 2010 1:29 am
by mianmajidali
$test[]='Products';
$test['Prodcuts']=array('Dell','Acer','HP');

hi to all,
i want to insert ' $test ' into mysql using php, its input will be received by form and will be stored into table.
now this is working with " print_r " and its output is as bellow....
print_r($test);
Array ( [0] => Products [Prodcuts] => Array ( [0] => Dell [1] => Acer [2] => HP ) )
now please guide me how can i insert it into table as single varible and how can i fetch it and use its values into nevigation like...
Products
.Dell
.Acer
.HP

thanks in advance.

Re: Help me in this array

Posted: Tue Jul 06, 2010 1:38 am
by cpetercarter
Have look at the serialize() function. It is often used to store an array as a single field in a database. The unserialize() function is used to recreate the array when the data is recovered from the database.

Re: Help me in this array

Posted: Tue Jul 06, 2010 11:02 am
by Jonah Bron
While serialize() is a very useful function, in this case, you should create a database structure to hold your data. Give us a graphical representation of the kind of data you're trying to store, and we can suggest something.