jeudi 19 novembre 2015

If Else Echo JSON array check

I have a JSON array that I am pulling values from per $vars.

within the JSON data are going to be some key words that I am looking for

I have a single

if else that looks like... (demonstration purposes)

if($FullName == $Data[$c]['manager']
    $FullName == $Data[$c]['leader'] || 
    $FullName == $Data[$c]['helper']) {
                                            $cheapLabor = 'NO';
                                            } else {
                                                    $cheapLabor = 'YES';
                                                    }

That works great.

However, now I want to define more specifically some if else points on status points which would represent their employement status. Each Emp Status is based on a group.

Would need it to check from the top of the food chain, then go downward to check if status = x if does then $cheapLabor = 'y'; else $cheapLabor = 'z';

I tried doing it, but it cant seem to get it to work. Here is what I am working with...

$repData = json_decode($json, TRUE);    
$c = 0;
$var = $repData[$c]['column'];

if(
    $FullName == $repData[$c]['ceo']) {
                                        $groups = '[13]';
                                        } else {
                                                $groups = '[5]';
                                                }                                                   
if(
    $FullName == $repData[$c]['director']) {
                                        $groups = '[10]';
                                        } else {
                                                $groups = '[5]';
                                                }
if(
    $FullName == $repData[$c]['regional']) {
                                        $groups = '[9]';
                                        } else {
                                                $groups = '[5]';
                                                }   
if(
    $FullName == $repData[$c]['project_manager']) {
                                        $groups = '[8]';
                                        } else {
                                                $groups = '[]';
                                                }   
if(
    $FullName == $repData[$c]['team_leader']) {$groups = '[6]';} 
    else {$groups = '[5]';
    }   
if(
    $FullName == $repData[$c]['rae']) {
                                        $groups = '[5]';
                                        } else {
                                                $staus = '[5]';
                                                }`

Aucun commentaire:

Enregistrer un commentaire