public function retour_nouvelle($id) { $requete = $this->_db->prepare('select * from nouvelle where id=:id'); $requete->execute(array(':id' => $id)); $results = $requete->fetchAll(); $tabobject = array(); if (empty($results)) { return false; } foreach ($results as $result) { $manouvelle = new Nouvelle(); $manouvelle->setId($result['id'])->setNom($result['nom'])->setAuteur($result['auteur'])->setContenu($result['contenu'])->setActive($result['active'])->setImg($result['img']); array_push($tabobject, $manouvelle); // Push l'objet $article dans le tableau $tabobject } return $tabobject; }
<?php /** * Created by PhpStorm. * User: Florent * Date: 17/04/2015 * Time: 10:48 */ require_once '../Navbar/navbar.php'; require_once '../Database/pdo.php'; require_once '../Entity/Nouvelle.php'; require_once '../EntityManager/NouvelleManager.php'; $active = 1; $manouvelle = new Nouvelle(); $manouvelle->setId($_POST['id'])->setNom($_POST['nom'])->setAuteur($_POST['auteur'])->setContenu($_POST['contenu'])->setActive($active); $monmanagernouvelle = new NouvelleManager($bdd); $monmanagernouvelle->modification($manouvelle); header('Location:../Main/nouvelle.php');