Building a tree structure (read as an Array) in mysql can be tricky, but it does this all the time. Almost any forum with nested threads has some mechanism for storing a tree structure. Like another poster said they should not be expensive.
The real question is how you want to use the data. If you need to be able to add / remove data fields from individual nodes in the tree, you can use one of two models
1) Model list of attachments
2) Modified pre-order tree traversal algorithm
(They sound scary, but it's not so bad, I promise.)
The first of these is probably the more common one you'll come across, and the second is the one I started using more often and has some useful advantages when you hug it around. Take a look at this page - it has an EXCELLENT record of everyone. http://articles.sitepoint.com/article/hierarchical-data-database
As another poster said, if you donβt need to change the data with queries or search inside the text, use the PHP function to save it in one field.
$array = array('something'=>'fun', 'nothing'=>'to do') $storage_array = serialize($array);
Presto-changeo, it's easy.
Shane source share