I forgot to explain one detail: in the query i used "uid=24702" because i wanted to test in one user only if the code was working, otherwise it would be a massive unnecessary query.