Jump to content

Auto refresh upon MySQL change


Flames

Recommended Posts

For real time chat's use some other technology, like Java or Flash

With JavaScript and PHP you might recheck for changes every 10 seconds or so.

 

Also, it might be good idea, to have a file on server, that would be rewritten each time a message is entered into database. Then you just have to compare the time when it was changed to the time of last displayed message to know if there are new messages.

Link to comment
Share on other sites

For real time chat's use some other technology, like Java or Flash

With JavaScript and PHP you might recheck for changes every 10 seconds or so.

 

Also, it might be good idea, to have a file on server, that would be rewritten each time a message is entered into database. Then you just have to compare the time when it was changed to the time of last displayed message to know if there are new messages.

 

 

I would just do SELECT * FROM posts WHERE time > last time checked;

 

Or compare post IDs or what ever.

 

The file management would get to be a pain.  Locking would come into play too, although under linux it should work fine.

 

 

 

 

 

@OP

 

 

As Mchl said, you could use Java or Flash to give the user actual real time content.  Both Java and Flash can open sockets, so you could just write a mini server on your server (lol) to handle the stuff.  Problem with that though, is that you must always have a script running.  Some webhosts aren't real keen on that, especially if you screw up and it hogs resources.  If you write a socket script in PHP with an infinite loop, make sure to use usleep or it will use 100% CPU.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.