title: MySQL AJAX PHP Notification Table Layout
body: <p>I am having issues finishing off my notification system on my website, where a user is notified when a post or comment is made. So far, I have 3 tables: users, posts, and notifications. When a user submits content to the posts table, for example, a notification will be generated in the <code>notifications</code> table including the timestamp, where the post was, and who did it. My question is not on coding any of this, but how my tables should be set up so that when i call the query via AJAX, the user gets a number representing the number of posts/comments they have NOT seen. How do I represent in tables that a notification has not been seen by the session user? Clearly, posts seen and unseen will differ among users, and I cannot seem to wrap my head around this. I have tried the following:</p>
  
  <ul>
  <li>Time stamps comparing the user's last activity and the notification activity. The notification will go away immediately after the user simply goes to any other page, not the location of the notification.</li>
  <li>Location of the notification versus latest page user was; Every time the user visited the page with recent activity, the notification would go away, but trivially, it would appear again after the person left</li>
  </ul>
  
  <p>So how do I simulate the 'read/unread' status of users and their notifications? Thanks everyone.</p>