PLIK INDEX.PHP <---------------------------------------> PLIK mems.php
showMems(); ?>
<----------------------------> PLIK Portal.php class Portal { private $db; function __construct() { $user= 'root'; $pass = ''; $this->db = new PDO('mysql:host=localhost;dbname=mems', $user, $pass); } public function tekst(){ echo "siemanko!"; } public function showMems(){ $query = $this->db->prepare('SELECT * FROM memy'); $query->execute(); $show = $query->fetchAll(); foreach ($show as $value) { echo '
'; echo '...'; echo '
'; echo '

'.$value['title']. '

'; echo '

'.$value['content'].'

'; echo '
'; echo '
'; } } }