title: Getting sub categories data from database to list
body: <p>I want to create a list which contains categories and on hover the category i need to display sub categories.I am able to display the parent categories in list.but couldn't understand how to get sub categories for that. In my table <strong>i have category_id, parent_id column and some other columns. If parent_id is '0'  it is main category and for subcategories it contains there category_id</strong>.So now i need to display sub-categories for main categories.I could not understand how to proceed.Can any one give advice. </p>
  
  <pre><code>&lt;ul class="betterList"&gt;
    &lt;?php 
          $con = mysql_connect("localhost","root","pwd") or die('couldnot connect to database'.mysql_error());
          mysql_select_db("DB",$con);
   $result=mysql_query("select * from table order by `name_en-GB`")or die("No table available with this name"."&lt;br/&gt;&lt;br/&gt;".mysql_error());
               while($row=mysql_fetch_array($result))
              {
                  $parent_id=$row['category_parent_id'];
                  $category_id=$row['category_id'];
                  if($parent_id==0)
  
                  {
     ?&gt;
                  &lt;li&gt;&lt;?php echo $row['name_en-GB'];?&gt;&lt;/li&gt;
                 &lt;?php }
                      ?&gt;
  
  
                  &lt;ul id="internal" style=" margin:0px; 
  padding:0;"&gt;&lt;li&gt;&lt;?php //echo $row['name_en-GB']; ?&gt;&lt;/li&gt;&lt;li&gt;data&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt; 
  
     &lt;?php
  
             }?&gt;   
  &lt;/ul&gt;
  </code></pre>