jeudi 4 août 2016

multiple and or logic in php if statement not working

I have gone round and round with this and I can't seem to get the logic correct for what I want.

Here is the code:

   function fetchFile() {
    global $directory;
    if (isset($_GET['id'])) {
        global $sampleIssue,$freeIssue;
        $id = mysql_real_escape_string($_GET['id']);
        $result = mysql_query("SELECT `volume`,`number`,`EditorMessage` FROM `articles` WHERE `id`='$id';");
        $article = mysql_fetch_assoc($result);
if 
        (($article['volume']!=$sampleIssue['vol'] || $article['number']!=$sampleIssue['no']) || ($article['EditorMessage']==='N')
         && ($article['volume']!=$freeIssue['vol'] || $article['number']!=$freeIssue['no'])){
    global $needsLogin;
            $needsLogin = TRUE;
        }

Basically I need for the login to be true or if any of the three conditions are met: $article['volume']!=$sampleIssue['vol'] || $article['number']!=$sampleIssue['no'] OR $article['EditorMessage']==='N' OR $article['volume']!=$freeIssue['vol'] || $article['number']!=$freeIssue['no'] I have tried switch cases too and I am just not getting it.

Aucun commentaire:

Enregistrer un commentaire