<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 26 May 2013 01:36:34 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPBuilder.com: Handling Hierarchical Data in MySQL and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18452</guid>
      <link>http://www.phpdeveloper.org/news/18452</link>
      <description><![CDATA[<p>
On PHPBuilder.com today there's a new tutorial showing you a way to <a href="http://www.phpbuilder.com/articles/databases/mysql/handling-hierarchical-data-in-mysql-and-php.html">work with hierarchical data in MySQL</a> from your PHP application in two different ways (methods).
</p>
<blockquote>
The hierarchical data structure is one of the most common data structures in programming. It represents a set of data where each item (except the root) has one parent node and one or more children nodes. Web programmers use hierarchical data for a number of applications, including content management systems, forum threads, mailing lists, and e-commerce product categorization. In this tutorial , I will explain how to manage hierarchical data using MySQL and PHP. Specifically, I will explore the two most popular hierarchical data models: adjacency list model and nested set model.
</blockquote>
<p>
They start with the adjacency list model, showing how to do a left join on the table on the parent ID to record ID and then filter through them, merging them into a main array as needed. The nested set model is slightly different and involves two new columns, a "lft" and "rgt", that point you to the records around the current one. This method makes the actual SQL query to find the structure a bit simpler, but isn't quite as flexible as the first method.
</p>]]></description>
      <pubDate>Thu, 06 Sep 2012 10:16:44 -0500</pubDate>
    </item>
  </channel>
</rss>
