$addedSQL = " \n SELECT numStage AS 'id', titre, dateFin, dateDebut, description, domaine, nbPoste, gratification, s.numEntreprise as 'entreprise', dateCreation\n FROM Stage s, Entreprise e\n WHERE s.numEntreprise = e.numEntreprise\n AND upper(s.titre) LIKE concat('%', upper(?) , '%')\n AND (upper(e.ville) LIKE concat('%', upper(?) , '%')\n OR upper(e.pays) = upper(?))"; $tab = array($_REQUEST['poste'], $_REQUEST['ville'], $_REQUEST['ville']); for ($i = 0; $i < sizeof($domaines); $i++) { $addedSQL .= " AND upper(s.domaine) LIKE concat('%', upper(?) , '%')"; $tab[] = $domaines[$i]; } $addedSQL .= " ORDER BY dateCreation DESC"; $req = $pdo->prepare($addedSQL); //var_dump($req); //var_dump($tab); $req->execute($tab); /*$req->execute(array(':poste' => $_REQUEST['poste'], ':ville' => $_REQUEST['ville']));*/ $listStage = $req->fetchAll(PDO::FETCH_CLASS, "Stage"); $html = ""; //var_dump($entreprise); //Chaques entreprise crée a comme observeur l'entrepreneur passer en parametre foreach ($listStage as $key => $stage) { $entreprise = Entreprise::creatFromId($stage->getEntreprise()); $numEntreprise = $entreprise->getId(); $titre = htmlspecialchars($stage->getTitre()); $nom = htmlspecialchars($entreprise->getNom()); $ville = htmlspecialchars($entreprise->getVille()); $pays = htmlspecialchars($entreprise->getPays()); $date = DateTime::createFromFormat('Y-m-d H:i:s', $stage->getDate()); $wellFormedDate = $date->format('d/m/Y'); $id = $stage->getId(); $html .= "<tr><th scope='row'>{$wellFormedDate}</th> <td><a href='displayEntreprise.php?id={$numEntreprise}'>{$nom}</a></td> <td><a href=\"viewStage.php?id={$id}\">{$titre}</a></td> <td>{$pays}, {$ville}</td> </tr> </a>"; } echo $html; }
require_once "autoload.inc.php"; require_once "init.inc.php"; $p = new webpage("Iut Stage"); $p->appendToHead(<<<head <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> head ); $p->appendCssUrl("style/bootstrap-3.3.5-dist/css/bootstrap.min.css"); //inclusion de la barre de navigation include_once "navbar.inc.php"; if (isset($_REQUEST['id']) && ($entreprise = Entreprise::creatFromId($_REQUEST['id'])) != null) { $nom = htmlspecialchars($entreprise->getNom()); $adr = htmlspecialchars($entreprise->getAdresse()); $tel = htmlspecialchars($entreprise->getTel()); $typeJurydique = htmlspecialchars($entreprise->getTypeJuridique()); $site = htmlspecialchars($entreprise->getSite() != null ? $entreprise->getSite() : ""); $pays = htmlspecialchars($entreprise->getPays()); $siret = htmlspecialchars($entreprise->getSIRET()); $siren = htmlspecialchars($entreprise->getSIREN()); $ville = htmlspecialchars($entreprise->getVille()); $codePostal = htmlspecialchars($entreprise->getCodePostal()); //Affiche tous les avis sur l'entreprise $commentaires = ""; foreach ($entreprise->getAvis() as $key => $value) { $pdo = myPDO::getInstance(); $rq1 = $pdo->prepare(<<<SQL