0

I have this loop i am trying to get to work, i edited the 2 if statements under the beginning of the code "foreach" but all i get is a white page now and i cant manage to get this to work, anyone that can see the problem ?

                        foreach ($shortUrlDomains AS $k => $shortUrlDomain)
                        {
                                   
                            
                                    if (($shortUrlDomain['premium_only'] ==  1) && ($Auth->subdomain == 1))
                                    {
                                        if(($shortUrlDomain['premium_only'] !== '1') && ($shortUrlDomain['premium_only'] !==  $Auth->id))
                                        {
                                            continue;
                                        }
                                        else(($shortUrlDomain['premium_only'] ==!  1))
                                        {   
                                            continue;
                                        }
                                    }
                    
                            echo '<option value="' . (int) $k . '"';
                            
                            if(isset($_REQUEST['shortUrlDomain']))
                            {
                                if ($k == (int) $_REQUEST['shortUrlDomain'])
                                {
                                    echo 'SELECTED';
                                }
                            }

                            echo '>';

                            echo $shortUrlDomain['domain'];
                            
                            if($disabled == true)
                            {
                                echo ' ('.safeOutputToScreen(t('unavailable', 'unavailable')).')';
                            }
                            
                            '</option>';
                            
                            
                            
                            
                            
                        }
                        echo '</optgroup>';
                        
                        ?>
  • 3
    `if ($a) && ($b) { ... }` is not valid syntax, you want `if ($a && $b) { ... }` And then if `$a` and `$b` need parens themselves, you want `if (($a) && ($b)) { ... }`. Count your parens, you're unbalanced. – Alex Howansky Jan 31 '22 at 19:30
  • 1
    Mismatched parenthesis. You're missing a `(` in your first if, – Kevin Y Jan 31 '22 at 19:31
  • hi. i updated my code with what i have now and it still wont work :/ – Klagor Mundavi Jan 31 '22 at 20:33
  • also `else(($shortUrlDomain['premium_only'] ==! 1))` is wrong.. it is either `elseif ($shortUrlDomain['premium_only'] ==! 1)` or `else`. You tell basically here an `elseif` in an `else`, which wont be propperly handeled. `else` doesnt require a context here – Dorvalla Jan 31 '22 at 20:37

0 Answers0