Jump to content

PHP/Ajax realtime updatingGG


prosportal

Recommended Posts

I'm by no means an expert when it comes to Ajax so I'm looking for support here. I'd like to display how many people are logged into our site using PHP, but have it update in real time. The query is simply SELECT isLoggedIn WHERE isLoggedin != 0 then returning the $query->num_rows;...

 

I'm familiar with using Ajax with JQuery with form validation,  but not sure how to do this.

 

Also, how much stress would this put on my server? Maybe it could just update every XX seconds or so.

 

Any ideas?

Link to comment
Share on other sites

You'll want to create a function that will query the desired results, then setup some ajax to get to that script and put it in a setInterval() call to call the function every x seconds.

As to the server, if it's a simple query like that it shouldn't be an issue, just don't call the function every 5 milliseconds.

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.