<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
class model
{
function pohranaPodataka()
{
require 'konekcija.php';
$query="select oznDvorana, kapacitet
from dvorana";
$result= mysqli_query($link, $query);
while($row= mysqli_fetch_assoc($result))
{
$pod[]=array('oznDvorana'=>$row['oznDvorana'],
'kapacitet'=>$row['kapacitet']);
}
$podaci=$pod;
return $podaci;
}
}
class view
{
function ispisPodataka($podaci)
{
echo '<a href="https://kresosusec.com.hr">'.'Početna'.'</a>';
echo '<table border="2">';
echo '<tr><th>'.' '.'<th>'.
'Dvorana'.'<th>'.
'Kapacitet'.'<tr>';
$x=0;
foreach($podaci as $key=>$val)
{
$x=$x+1;
$dvorana='<a href="rezervacija.php?dvorana='.$val['oznDvorana'].
'">'.$val['oznDvorana'].'</a>';
echo '<tr><td>'.$x.'<td>'.
$dvorana.'<td>'.
$val['kapacitet'].'<tr>';
}
echo '<table>';
}
}
class controler
{
public $_Model;
public $_View;
function __construct()
{
$this->_Model=new model();
$this->_View=new view();
}
function start()
{
$podaci= $this->_Model->pohranaPodataka();
$this->_View->ispisPodataka($podaci);
}
}
$pokreni=new controler();
$pokreni->start();
?>
</body>
</html>