I'm writing a PHP / MySQL chat room from scratch. I'm having trouble. The chat log does not display messages in real time. Each chat message is stored as a record in MySQL.
How do I make a PHP page update itself with new chat messages every time one is submitted?
Here's what I've tried:
- Updated meta tag to refresh the PHP page -- entire page reloads even if no chat messages have been submitted. Wastes too many resources.
Here's what I'm thinking:
- Make Javascript monitor changes to the database
- Create a trigger in MySQL to monitor changes
Has anyone had experience with this? Can you offer some advice?
David
Tags: