title: URL Rewrite query database?
body: <p>I'm trying to understand how URL rewriting works. I have the following link.</p>
  
  <pre><code>mysite.com/profile.php?id=23
  </code></pre>
  
  <p>I want to rewrite the above url with the users first and last name.</p>
  
  <pre><code>mysite.com/directory/liam-gallagher
  </code></pre>
  
  <p>From what I've read however you specify the rule for what the url should be output as, but how do I query my table to get each user name? </p>
  
  <p>Sorry if this is hard to understand, I've confused myself!</p>