Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7763867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:46:01+00:00 2026-06-01T14:46:01+00:00

I have a simple MySQL table for storing notification in a web with social

  • 0

I have a simple MySQL table for storing notification in a web with social networking feature written in PHP.

+----------------------+
| Notifications        |
+----------------------+
| (PK) notification_id |
| user_id              |
| uri                  |
| message              |
| seen                 |
| created_at           |
+----------------------+
  • notification_id is PK (pretty self-explanatory)
  • user_id is the ID of user who gets the notification
  • uri is the internal URI where the browser will go when the user clicked the notification, mostly it links to the individual occured event page (such as linking to a user’s photo permalink when the notification is about someone commenting at it)
  • message is the notification message
  • seen is stored as boolean, it indicates wether the notification has been read or not (it is the most important part in this question)
  • created_at is just a timestamp

I have done most of the notification mechanism, but the remaining is the seen/unseen part.

I want to show only the unseen notification in the dropdown menu in the top navigation bar (like Facebook does), and the user can click a link to the page showing all notifications.

Where is the best place to put the code to trigger marking it as seen? It should be marked ‘seen’ when the designated user has read the notification content and get to the individual event page (ie. by clicking it)

I have thought of some methods, another alternatives are welcome.

  • Using javascript to intercept user’s click on notification and make ajax request to ‘mark as seen’ before proceeding to notification’s URI
  • Make PHP script in the destination URL to update the seen record in the database. The problem with this method is there is no relationship between the individual post with the notification record.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:46:02+00:00Added an answer on June 1, 2026 at 2:46 pm

    If I were in a similar situation (and I hadn’t implemented an events system), I’d have the notification link be to a pass-through script. Within that script, just have it mark the notification as seen and redirect the user on. Since your notifications and objects aren’t related, you could use GET request parameters (?type=photo&id=1&notification=1) to figure out which object and such.

    I don’t recommend using Javascript to do it… It’s too unreliable, in my opinion. You never know if the user actually has Javascript enabled on their browser and such.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple MySQL table thats contains a list of categories, level is
I have got a simple MySQL table and primary index (id) is not numbered
I have a simple table in MySql whose raison-d'être is to store logs. The
My MySQL table is simple. I have 3 fields: an index a url a
I have a simple table on my local server. mysql> desc table ; +-------+---------+------+-----+---------+-------+
I have a simple Message table, with 2 indexes: mysql> show keys from Message;
So I have a simple Apache with MySql I am developing a PHP app.
I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
I have a method which does a simple mysql insert, when I tried to
I have a mysql table with over 4 million of data; well the problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.