I have the following function:
function rank() {
$sql = "SELECT * FROM applicant_details";
$results = $this->db->query($sql)->result();
$sql3 = "SELECT * FROM job_advert";
$job_advert = $this->db->query($sql3)->result();
foreach ($results as $applicant) {
$applicant_age = $applicant->age;
$applicant_id_number = $applicant->id_number;
foreach ($job_advert as $advert) {
$job_title = $advert->job_title;
$age = $advert->age;
if ($applicant_age >= $age) {
echo '<pre>';
var_dump($applicant_id_number);
echo '</pre>';
echo '<pre>';
var_dump($job_title);
echo '</pre>';
}
}
}
This function will display the candidates id_number that matches the age requirement of a job advert and the job title it matches. How would I give these candidates a rank, ie. if candidate age matches job_advert age candidate +1, then pull out the best ranking candidates. what would be the best way to do so?
I ave tried inpuing a variable that increment for each matching candidate, bt this failed as it incremented for each record, eg. I have 10 records, then it would display the number of each maching record.
ps. I am still a student and this is for educational purposes(just incase someone thinks "my organization" is discriminatory about age)