title: Display category and subcategory into two column using php
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11999761/displaying-category-and-subcategory-into-two-column-using-php">Displaying category and subcategory into two column using php</a>  </p>
  </blockquote>
  
  
  
  <p>How can i display categories and subcategories in this format using php.</p>
  
  <pre><code>  categories  subcategories
      ----------  -------------
      php         php4
      java        java4
      java        java5
  </code></pre>
  
  <p>My table is</p>
  
  <pre><code>cattitle  subcattitle
  --------  -------------
  acer       
              php
              java
  compaq      java4
  dell        
              laptop1
              laptop2
  </code></pre>
  
  <p>"acer" is a main category and "php" and "java" are its subcategory and so on. I want to display that type of structure using php. Also it is coming from one table. Table name is <code>categories</code> and fields are <code>id</code>, <code>parentid</code>, and <code>cattitle</code>.</p>
  
  <p>i have tried this code..</p>