title: custom php forum - showing new/unread posts
body: <p>I have written myself a custom forum script using php.  I decided against using phpbb and others as I wanted 100% flexibility with what I was doing.</p>
  
  <p>I've hit a problem though:</p>
  
  <p>How do I show a user if a post is new/unread or not.</p>
  
  <p>Two solutions come into mind:</p>
  
  <p>1) Cookies
  2) Database</p>
  
  <p>I don't want to use cookies because they can be deleted by the user and the firefox side of things means they are auto deleted.  Either way, I don't want to use cookies.</p>
  
  <p>The database is causing me a problem because I can't seem to get the database structure sorted in my head!  The first solution I could think of was:</p>
  
  <ul>
  <li>When a user loads the forums up, check the last time they loaded the forums up</li>
  <li>Check all the posts have been made since they last viewed the forums</li>
  <li>Enter those values into the database in a table with fields (user_id, post_id).</li>
  <li>that value is then deleted from the database when they view the post</li>
  </ul>
  
  <p>The problems I am thinking with this is it's a huge database drain.  It seems SO inefficient.  I'm sure there are methods with arrays in fields, but I'm not really that good with arrays. </p>
  
  <p>Could anyone give me an indication of a good database design for this as well as any code that has to go with it?  It's driving me crazy as I just can't think of a solution that's good and efficient with the server.</p>
  
  <p>Thanks a lot in advance for your help and assistance,</p>
  
  <p>James.</p>