title: How can I query using a foreign key in MySQL?
body: <p>Right now I have a small database with two tables that look something like this:</p>
  
  <pre><code>    users table
      ====================
      id  name   status_id
      1   Bobby  3
      2   James  2
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    statuses table
      =============
      id  value
      1   Waiting
      2   Approved
      3   Other
  </code></pre>
  
  <p>status_id is setup as a foreign key constraint to id from the statuses table. My query looks something like this:</p>
  
  <pre><code>SELECT *
  FROM `users`
  WHERE `status_id` = 2";
  </code></pre>
  
  <p>When I display <code>$row['status_id']</code> it outputs <code>2</code> but I would like it to display as <code>Approved</code> instead, what is the best way to accomplish this?</p>