title: Sorting through mysql table and order by amount
body: <p>I'm currently trying to create a list of 5 blog titles of mine, where they are ranked from 1 to 5, 1 being the most popular, while the 5 being the least popular. And how I am ranking them is through views. Now I already have the views working and thats in a table called blog_views, while the blog is called blog.</p>
  
  <p>So what I'm trying to do is have PHP sort through how many views are recorded in blog_views through the blog id that's recorded in them, then list the blog title through which ever has many views, to the least amount of views. How would I be able to do that? I hope my question was clear!</p>
  
  <p>I tried experimenting, but failed, because I couldn't find the right approach to this.</p>
  
  <p>Thanks for the help in advance!</p>
  
  <p>Here is the Schema of the two tables:</p>
  
  <pre><code>Blog{ blog_id, title, body, userinformation}
  
  blog_views{ viewid, ip, time, blog_id, used}
  </code></pre>