質問

I want to check if $AD = 1, then if not pass to another function, but if $AD = 1 check if AC = contains some value, if not do some stuff.

if ($AD == '1'){
if ($AC == ''){
echo 'AC is empty';
} else { 
///////Function/////
}
}

Thanks.

役に立ちましたか?

解決

An else if statement must always correspond to a beginning if statement on the same "nesting level".

Your inner else if does not have any beginning if statement and it therefore fails.

if ($AD == 1) {
  if ($AC == '') {
    echo 'empty';
  }
}
else {
  otherFunction($AD);
}

Since this is basic PHP (actually IFs are mostly not language-dependent) stuff, I recommend you reading a beginner's tutorial.

他のヒント

if ($AD == 1){
  if ($AC == ''){
    // some code where ac has the value
   } else {
     // some code where ac doesn't have the value
   }
 } else  {
   // other function
 }

That should do it

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top