I am building an automated membership updater
this allows an organisation to upload their list of members (csv format) to a secure space
then via cron job the list is read and the names are entered into the system
the idea is that the organisations upload their entire list once a week -
system will check for changes and edit accordingly
any members that are NOT in the list will be assumed to be expired
so during the process to expire members I build an array to include active members, do a PHP string join on it and use that in my SQL UPDATE to say "if ID is NOT in this list expire me"
$idlist=join(' AND ms.u_id != ',$idlist);
$sql = "SELECT ms.u_id, ms.ms_id, ms.ms_end, ms.ms_start, c.u_email FROM memship_duration AS ms
LEFT JOIN ctcr as c ON (c.u_id=ms.u_id AND ms.agnt_id=c.agnt_id)
LEFT JOIN agnt ON (ms.agnt_id=agnt.agnt_id)
WHERE (ms.u_id != $idlist) AND ms.agnt_id='$fileagnt' AND ms.ms_end >='$datetoday' ORDER BY ms.ms_id DESC " ;
while...{
.. send expiry email
$expirylist[]=$row['id-of-person-to-expire'];
}
then do an UPDATE to expire them
but I can see the imploded string becoming enormous - is there a better way to do this?