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
https://forums.phpfreaks.com/topic/260585-phpajax-realtime-updatinggg/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.