title: Mysql: Get all the linked rows in a table
body: <p>I have a table structure</p>
  
  <p>kinda like this</p>
  
  <pre><code>id  |   title | next 
  1   |  test   | 5
  2   |  test   | 0
  3   |  test   | 0
  4   |  test   | 0
  5   |  test   | 3
  </code></pre>
  
  <p>Now, as you see 1 points to next item 5 and 5 points to next item 3 and 3 denotes the end</p>
  
  <p>I need a query, from which I can get 1, 5, 3 serially in one column and their title also</p>
  
  <p>like</p>
  
  <pre><code>result | title
  --------------
  1      |  test
  5      |  test
  3      |  test
  --------
  </code></pre>
  
  <p>please help. I dont even know how to get started at such query.</p>