At the moment I have this code:
$divisions = explode(",", $mychecklist->dept);
foreach($divisions as $division) {
$divs=get_record('induction_emails','id',$division);
$useremail = get_record('user', 'email', $divs->email);
echo $useremail->id;
}
This basically gets the division id from induction emails table, then checks the users table to match email to user. The final result I want is the user id's.
Once I have the user id's I want to put them into an array.
Any help would be appreciated. Thanks in advance.
get_recordinvolve DB query, you won't like to iterate/repeatedly query database to get single record, reconstruct the function design to allow single query-->fetch all-->return the array