title: i want to run a query to get Hierarchy of catagory_name
body: <p>if my database look like this:-</p>
  
  <pre><code>| CATAGORY_ID | CATAGORY_NAME | PARENT_ID |
  -------------------------------------------
  |           1 |             x |         0 |
  |           2 |             y |         1 |
  |           3 |             z |         2 |
  </code></pre>
  
  <p>i used this to get one hirarchy but i want ds to run untill its get parent_id =0</p>
  
  <pre><code>SELECT catagory_name
  FROM catagory_master
  WHERE catagory_id = ( 
  SELECT parent_id
  FROM catagory_master
  WHERE catagory_id =4 ) 
  </code></pre>
  
  <p>if i want x-y-z for catagory_id=3 and x-y for catagory_id=2 and x for catagory_id=1
  please help i have to run this in php script</p>