So I've created a program in PHP and MongoDB for my website in which I can see useful data about my members, and filter through them.
A query could for example look like: Show me everybody who's Male, between 20 and 30, has visited the site in the past 7 days, and logged in to the site at least 10 times.
With the query above, I would get for example 100 people, and I want to set an automated email (I have the email functions) specific to the filters.
So, in this case, 100 emails would be sent, but every time a member triggers the above query (when a user logs in and matches the above query, for example the person could change his sex from Male to Female and perhaps now meet the query), the event would be triggered and an email would be sent.
How would you go about 'storing' these kind of queries, and actually testing them against the members when they visit the site?
Ps. The queries can be unknown to me, as other people could be using my website, so I cannot run an "if" logic when users login, as I don't know the query criteria of other people.