lundi 3 avril 2017

Else if statement not working using GET parameters

I am trying to get information out of my database by using GET parameters. The problem is that whenever $_GET['archived'] is set to yes it still executes the no / !isSet section.

if(isSet($_GET['archived']) == "no" || !isSet($_GET['archived'])){
        // find out how many rows are in the table 
        $r = $connection->prepare("
            SELECT  *
            FROM    categories
            WHERE   archived='no'
        ");
    } else if(isSet($_GET['archived']) == "yes"){
        // find out how many rows are in the table 
        $r = $connection->prepare("
            SELECT  *
            FROM    categories
            WHERE   archived='yes'
        ");
    }

Aucun commentaire:

Enregistrer un commentaire