It almost seems as if the "$randsql_result" is ignoring the "WHERE clientID = $clientIDm". I just tried the modification that you said to try, and it still didn't work, and it seems like it just pics in some kind of somewhat random order. In english terms, this is what I am trying to do.
Pick a random target for each clientID. There should only be about 55 clientID's.
The way I am trying to do this is
1. get a list from the client table of all of the clientID's with their perspective clientName.
2. run a while loop that cycles through each clientID, then selects all of the targets that have that clientID, then pick a random target from the list of targets with that clientID, then goes to the next clientID.
3. it will eventually send an email to that target, but I know how to add that after I can make sure that it selects properly.
Let me know what you think... Thanks for your help!!! Dan