<?php
class Recherche {
    public static function getRechercheByNoRechercheAndNoVisu($noRecherche, $noVisu) {
        $query = "SELECT * FROM recherche WHERE NoRecherche=:norecherche AND NoVisu=:novisu ORDER BY Position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":norecherche", $noRecherche);
        $statement->bindParam(":novisu", $noVisu);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getRechercheByNoRechercheAndNoVisuAndNoChamp($noRecherche, $noVisu, $noChamp) {
        $query = "SELECT * FROM recherche WHERE NoRecherche=:norecherche AND NoVisu=:novisu AND NoChamp=:nochamp";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":norecherche", $noRecherche);
        $statement->bindParam(":novisu", $noVisu);
        $statement->bindParam(":nochamp", $noChamp);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getRechercheByNoRechercheAndNoVisuAndPosition($noRecherche, $noVisu, $position) {
        $query = "SELECT * FROM recherche WHERE NoRecherche=:norecherche AND NoVisu=:novisu AND Position=:position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":norecherche", $noRecherche);
        $statement->bindParam(":novisu", $noVisu);
        $statement->bindParam(":position", $position);
        $statement->execute();
        return $statement->fetch();
    }  
}