title: Joining mysql tables for echo via PHP script and cache everything
body: <p>Database X holds 2 tables. Message table.</p>
  
  <pre><code>Message table:
  Message_id     User_id     Posted_date            Message
  1              141         2012-05-05 05:21:21    Hello
  2              441         2012-05-05 05:25:21    How are you?
  3              12          2012-05-07 05:25:21    How's it going?
  </code></pre>
  
  <p>And user table</p>
  
  <pre><code>User table
  User id        User name
  12             Arthur
  141            Boris
  441            Andrew
  </code></pre>
  
  <p>I'm using a PHP script to pull and echo data from the message table on my website. This should show last X amount of messages. However, as you see, the message table does not hold User names which should be displayed along the message. I know I Must use some kind of a join command, but am not sure how to format it properly in order for php script to echo the following:</p>
  
  <pre><code>User name | Date
  Message
  </code></pre>
  
  <p>I'm not sure how to format this query request. Would appreciate if someone could give me an example using the data I gave above.</p>
  
  <p>Now, lastly, I would need the information to be refreshed only once in 15 minutes so if many people view it, it does not cause unnecessary stress on the server. What caching options are there available with PHP? </p>