Hello everybody and thank you for your answer.
I have tested your solutions but the problem is always the same.
The if sentencs cannot reconize the
$check_count
as a sentence.
$check_count should be replaced by the sentence
($flag_adm_cat_0[0] == $flag_adm_cat_check) or ($flag_adm_cat_0[1] == $flag_adm_cat_check)
I have inserted an
echo"$check_count"
and the result give: (7==63) || (9==63) AND (2 == 2)
It seems tha the if statement cannot use this result correctly.
if ((7==63) || (9==63) AND (2 == 2)) {...}
doesn't work.
Full script:
$flag_adm = "2";
$flag_adm_cat = "7,9";
// Special administration
$flag_adm_cat_check = getparentlink_main($id_sub_cat,$description_main);
$flag_adm_cat_0 = explode (",", $flag_adm_cat);
$flag_adm_cat_count = count(explode (",", $flag_adm_cat));
$tst_count= 0;
//$check_count ='(';
while ($tst_count != $flag_adm_cat_count){
$check_count .= '(';
$check_count .= $flag_adm_cat_0[$tst_count];
$check_count .= '==';
$check_count .= $flag_adm_cat_check;
$check_count .= ')';
$tst_count++;
if ($tst_count != $flag_adm_cat_count) {
$check_count .= ' || ';
}
}
//$check_count .= ")";
$check_count .= "AND ($flag_adm == 2)";
echo"$check_count";
if ($check_count) {
echo"Working";
}
Thanks in advance