i am currently programming my own social network (temal.cf). Users can register, login and chat with other users. If user 1 logs in, the row "last_login" will update to the current time and the row "status" will change to "online" in the phpmyadmin database. If user 1 logs out it will set the row "status" to "offline". So if a user is just closing his browser or is closing the tab, he will just stay as online. Thats a problem. My idea to solve this now is to update every 1 or 2 minutes the row "last_login" in the database. If user 1 closes his browser, it wont send updates to the database anymore. And if a different user checks the online status of user 1, it will check if the difference between the current time and between the time than user 1 logged last in is more than like 2-3 minutes, if yes, it should say that user 1 is offline, if not,it should say user 1 is online.
So how can I automatically send a new record to the sql phpmyadmin database every minute in php language?
(I know my english is verby bad, sorry:/)
this is not passible just with PHP you have to use some kind of frontend solution with backend solution
few solutions are:
there is a lot of solutions but most of them are just TERRIBLE and your BOSS will not be happy:D, best is Socet.io for your case, or just do 2 and send it every 10 min and its OKEY if your app have some delay in ONLINE status...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.