<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - tylerhall</title>
<link>http://snipplr.com/users/tylerhall/language/php/tags/sql</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 20 Nov 2008 06:52:21 GMT</pubDate>
<item>
<title>(PHP) Build Nested Array From SQL</title>
<link>http://snipplr.com/view/4383/build-nested-array-from-sql/</link>
<description><![CDATA[ <p>During the time that I’ve been programming I’ve continually run into times when I needed to be able to store a multi-level list into a database and retrieve it. I’ve used this in a CMS system to allow uses to create and nest their own menu options or to allow users to create and nest categories of items. Saving it was never a problem, but retrieving it and building a PHP array with nested structure was a messy task. The problem was that you couldn’t easily enter a variable four levels deep into an array without knowing all of the parents of that item. This was okay if you retrieved the data in order of parents, but that meant if you wanted to sort the data by another column (such as name), you would have to do multiple passes through your data to continually reshuffle it.</p> ]]></description>
<pubDate>Wed, 19 Dec 2007 15:15:51 GMT</pubDate>
<guid>http://snipplr.com/view/4383/build-nested-array-from-sql/</guid>
</item>
</channel>
</rss>