I have table user
where id
= primary key, lastchange
= int with lastchange
data (in seconds). And i have frontend page with js script. Also all users placed in div like table by pages. So, items has user id and used changed timevalue in attributes.
I want to request all changed user ids in 1 request (1 http and 1 sql). They can be changed by other user on site.
How can i do this? I dont want check every user in page by timer, there is too many requests.
In my mind it looks like:
- js do get request with list of users in page in json format
[{"id":1, "lastchange":123123},{"id":2, "lastchange":123123}...
- Php does request in mysql like
SELECT * FROM `users` WHERE `id` IN (1, 2, 3) AND `lastchange` NOT IN (123459, 123456, 123459);
(this not works fine, there is no queue forlastchange
, it checks all inside braces and result are wrong) - Php return only ids of different rows
[1, 15, 22]
etc. to js. - Js check every id separately in other request getting full info about user by id
I can check every user in php separately, but i want to know how can i do it with 1 SQL
request
Sorry my bad English.