Originally I was thinking of using a loop but the more I think of what I need to do the more I see a problem.
I have 2 tables t1 ans t2. I need to check if there are entries in t1. If yes, I need to get a few values from it and get some users from t2 that match the values from t1.
Then I need to hit t1 again, retrieve values and group them according my user groups, email the data to the groups accordingly and delete the values that I just used from t1.
Now, if I use a loop to get values from t1 and then, while I'm the first row, delete other rows after sending data to users, I probably mess up my innitial loop. Sort of catch 22.
So I was thinking that all I need to do, instead of running first loop, just check if there are values, retreive them , do my other steps and after emailing and deleting is done, refresh my page again somehow and do it over.
Shall I use header ("Location:http://www.mysite.com/mypage"); to restart my process. It may need to repeat anywhere from 0 to 4 times max. Doesn't have to be the most efficient code, I can run it via CRON nightly. Just trying to get a confirmation that I am on the right track.