Real-time database monitor

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have built a messaging system where users of a website can send
messages to each other and they will appear in the other users inbox
for viewing next time they log in. In a bar at the top of the page it
says "Inbox (0)" if they have no new messages and, yup, you guessed it
"Inbox (2)" if they have two waiting messages.  If someone sends them
a message while they are sitting on some page of the website I would
like the counter to increase.  Right now the mysql query runs each
time a page is loaded so they would be notified then but I would like
it to somehow update the inbox number while they sit on a page.  Does
anyone have any ideas?  Thank you in advance for your help!

Re: Real-time database monitor

Quoted text here. Click to load it

I forgot to mention that each time someone sends a message it creates
a new record in a single table in the database.  What I am looking for
is a way to monitor that database and find any records with "msg_to"
equal to the user id of the person logged in and "msg_unread" equal to

Re: Real-time database monitor

Justin Voelker wrote:
Quoted text here. Click to load it

You aren't going to be able to do this unless they refresh the screen.
The browser knows nothing about changes on the server.

AJAX can help.  Try comp.lang.javascript.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline