private function setSession($id) { sec_session(); set_session($id); header('Location: ../../pocetna/'); die; }
<?php ob_flush(); require_once '../php/lib/db.php'; require_once '../php/lib/session.php'; sec_session(); class Postovi { public function __construct() { $this->database(); $qu = "SELECT * FROM post ORDER BY id DESC LIMIT 20"; $db = $this->db->prepare($qu); $db->execute(); $this->display($db->fetchAll()); } private function database() { global $con; $this->db = $con; } private function display($rez) { foreach ($rez as $row) { ?> <div class="post"> <?php $this->options($row); ?>