I would like to store a nested associative array in MySQL. I need this for a nestable navigation menu on my site. There should be no limit to the level of nesting.
I have researched the nested set model and the adjacency list, but am unsure of which to use for my needs.
Ideally, I will be able to query my table in a way that I can reconstruct my associative array in PHP and then use this to construct my navigation menu. Records may be added / changed / re-ordered, but this will only happen infrequently.
I am looking for an example table structure for MySQL (InnoDB), queries to get and re-order the records, and update, delete and add new records. I am using PDO in PHP so any example code of how to turn the record set into the associative array would also be helpful.
` list and doesn't need to be unique. If there is a parentID assigned but it doesn't exist, that item would not be shown. I'm a little hungover to explain it right now, but like I said I've been using the code from that post for a long time now. I run a CMS where the user makes the navigation.
– Wesley Murch May 16 '14 at 18:41