prosportal Posted April 9, 2012 Share Posted April 9, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/260585-phpajax-realtime-updatinggg/ Share on other sites More sharing options...
AyKay47 Posted April 9, 2012 Share Posted April 9, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/260585-phpajax-realtime-updatinggg/#findComment-1335634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.