I have a mysql members table. It have a column name of "lastonline". I want to update this column every two minutes in PHP. I think it would be possible through ajax time interval.Please advise me how to achieve this easily?
Asked
Active
Viewed 859 times
3 Answers
2
If you're creating an AJAX application, you can simply log a "last_online" column that gets updated with a date every time the user request a page (either via AJAX or HTTP).
If you must do this with AJAX, Prototype offers a PeriodicalExecutor that you can use to send requests at a predefined interval:

nickb
- 59,313
- 13
- 108
- 143
0
I do not recommend to do it via ajax, but to write a scritp ad hoc and run a cron every 10 minutes and you are upgrading.

JellyBelly
- 2,451
- 2
- 21
- 41
-
1sorry i want every 2 mins not every 2 secs. Please refer this link http://stackoverflow.com/questions/7964903/how-to-get-currently-logged-users-in-mysql. I want to know who are currently online – w3father Nov 02 '11 at 12:46
0
Why don't you you update the "lastonly" column with every request a user makes? Do you really need the two-second resolution?.

chiborg
- 26,978
- 14
- 97
- 115