Checking when data changes in a database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Checking when data changes in a database

Post by like_duh44 »

Hello, I have a chat that i'm making, going along very well. (http://www.aataclan.tk click on =AATA= webchat on the left) Anyway, I have the current version to get information from a database of the users online and posts available. What script would allow me to only have the page refresh (echo "<meta http-equiv=\"Refresh\" content=\"0\">"; ) when the data in the database changes? Thanks
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

I hardly think you can without using some sort of cron-job directly on the server, not that it sounds like a good idea.

Whats wrong with letting the user sefl update the page when he/she needs, or by using a slight more modest meta-refresh of 5 or 10?
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

Well, right now it refreshes the page every 5 seconds, which is really annoying because both frames click every refresh. Instead, there isnt any way to only have it refresh the page when the data changes?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Well, if youre using frames, you should have >= two pages right. Why not just add the meta-refresh to that particular page that needs it?

Or am I totaly lost?
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

you should check out the chat...but it still refreshes the frames with the users and posts, which is not only annoying, but if someone is reading the posts at the bottom, it refreshes and moves them up to the newest one. Its easier to understand if you check the site
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Cant you make a #name tag at the bottom of the chat-page (not visible to users) and in the meta-refresh call that whateverpage.php#hidden

That way when it updates its automaticly at the bottom of the page...
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

lol, i mean, if people are reading older posts (at the bottom) every 5 seconds it refreshes and puts them to the top (new posts). There isnt any way to get it to only refresh when the database data changes?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

A foo, was reading it backwards, not new posts at top...
No, I'm out of clues.
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

well, an idea, but no clue how to work it, would be to have a while of some sort
Post Reply