vendredi 24 février 2017

strpos returning true in foreach

it looks like my strpos is only checking the last item in my foreach loop. the first and third condition works properly but not the third. i'm not quite sure where i'm going wrong but any help would be amazing! also excuse the custom commands - it's a company's version of php.

 //get values from the tables 
foreach (sgapiGetValue(15) as $rowid => $rowarray){   
//loop through each row
  foreach ($rowarray as $optionsku => $reportingvalue){  
    $output .= sgapiPrint_R($reportingvalue) ."<br>";
    //type one 
    if (sgapiStrPos($reportingvalue,"C") === 0 && sgapiStrPos($reportingvalue,"D") === 0 || $year != "2016") {
      $output .= sgapiStrPos($reportingvalue,"D");
      sgapiSetValue(733,1);
      sgapiSetValue(735,"text for this box");
  } 
    //type two
  //  $array[] = $reportingvalue;
   // $output .= sgapiPrint_R($array);
    if (sgapiStrPos($reportingvalue,'C') !== false && sgapiStrPos($reportingvalue,'D') === false) {
    sgapiSetValue(733,2);  
      sgapiSetValue(735,"custom text");
        } 
    //type three
    if ($year == "2017" && sgapiStrPos($reportingvalue,"C") === false  && sgapiStrPos($reportingvalue,"D") === false) {
    sgapiSetValue(733,3);   
        } 
} 
}

THANK YOU! (:ᘌꇤ⁐ꃳ 三

Aucun commentaire:

Enregistrer un commentaire