Hi There,
I create an SQL statement to retrieve some data from DB. However I can not do the third if statement! my code;
$search = care_query("
SELECT
contact_number, role, is_active
FROM
contact_roles
WHERE
contact_number='$mn' AND is_active='Y' AND role like 'S%';
");
while($row = care_fetch_array($search))
{
$role= $row['role'];echo "<pre>";
}
if($role =='SAS' || $role =='SBS' || $role =='SPS'){
$status="student";
} else if($role !='SAS' || $role !='SBS' || $role !='SPS'){
$status="specialist_workers";
}
else if (($role=='SAS' || $role=='SBS' || $role=='SPS') && ($role!='SAS' || $role!='SBS' || $role!='SPS' && $role!='') ){
$status="both";
}
if ($status=="student"){
// print related form to user and post the data to next page
echo "student";
}
else if ($status=="specialist_workers"){
echo"specialist worker";
}
else if($status=="both"){
echo"both";
}
}
So basically what I want to do is:
1st select SAS or SBS or SPS only if exist in the row the status is student. -> WORKS
2nd select start with S but not SAS SBS SPS the status is specialist worker. ->WORKS
3rd select (SAS or SBS or SPS) AND (NOT SAS SBS SPS but start with S)the status is both. -> NOT WORKING
I hope I make myself clear enough
Thank You