//if they dont have a sponsors id, then they,ve never donated for sure, so keep them
//if they DO have a sponsors id, we need to check if tere is a donation record for them
//and if so, remove them if there is because tey have donated in the past
foreach($neverlistAS$uid=>$u){
if($u['sponsors_id']){
$q=mysql_query("SELECT * FROM fundraising_donations WHERE status='received' AND sponsors_id='{$u['sponsors_id']}'");
if(mysql_num_rows($q)){
// echo "removing $uid because they have donated in the past <br />";
unset($neverlist[$uid]);
}
}
}
//if they dont have a sponsors id, then they,ve never donated for sure, get rid of them
//if they DO have a sponsors id, we need to check if tere is a donation record for them
//and if not remove them if there is because tey have not donated in the past
foreach($pastlistAS$uid=>$u){
if($u['sponsors_id']){
$q=mysql_query("SELECT * FROM fundraising_donations WHERE status='received' AND sponsors_id='{$u['sponsors_id']}'");
if(!mysql_num_rows($q)){
// echo "removing $uid because they have NOT donated in the past <br />";
unset($pastlist[$uid]);
}
}
else{
// echo "removing $uid because they have NOT donated in the past <br />";
unset($pastlist[$uid]);
}
}
$lastyear=$config['FISCALYEAR']-1;
foreach($lastyearlistAS$uid=>$u){
if($u['sponsors_id']){
$q=mysql_query("SELECT * FROM fundraising_donations WHERE status='received' AND sponsors_id='{$u['sponsors_id']}' AND fiscalyear='$lastyear'");
if(!mysql_num_rows($q)){
// echo "removing $uid because they have NOT donated last year <br />";
unset($lastyearlist[$uid]);
}
}
else{
// echo "removing $uid because they have NOT donated last year <br />";
unset($lastyearlist[$uid]);
}
}
foreach($thisyearlistAS$uid=>$u){
if($u['sponsors_id']){
$q=mysql_query("SELECT * FROM fundraising_donations WHERE status='received' AND sponsors_id='{$u['sponsors_id']}' AND fiscalyear='{$config['FISCALYEAR']}'");
if(!mysql_num_rows($q)){
// echo "removing $uid because they have NOT donated this year <br />";
unset($thisyearlist[$uid]);
}
}
else{
// echo "removing $uid because they have NOT donated this year <br />";