Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!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';
- if(isset($_GET['broj']))
- {
- $broj=$_GET['broj'];
- $pocetno=($broj-1)*15;
- $y=($broj-1)*15;
- }
- else
- {
- $broj=1;
- $pocetno=0;
- $y=0;
- }
- $query="select imeStud,prezStud,mbrStud
- from stud
- limit $pocetno,15";
- $result= mysqli_query($link,$query);
- while($row=mysqli_fetch_assoc($result))
- {
- $pod[]=array('imeStud'=>$row['imeStud'],
- 'prezStud'=>$row['prezStud'],
- 'mbrStud'=>$row['mbrStud']);
- }
- $query2="select imeStud,prezStud,mbrStud
- from stud";
- $result2=mysqli_query($link,$query2);
- $numRows= mysqli_num_rows($result2);
- $total=ceil($numRows/15);
- $podaci=array('pod'=>$pod,
- 'y'=>$y,
- 'total'=>$total,
- 'broj'=>$broj);
- return $podaci;
- }
- }
- class view
- {
- function ispisPodataka($podaci)
- {
- echo '<center>';
- echo '<a href="https://kresosusec.com.hr">'.'Početna'.'</a>'.'<br>';
- echo '<table border="2">';
- echo '<tr><th>'.' '.'<th>'.
- 'Ime'.'<th>'.
- 'Prezime'.'<th>'.
- 'MBR'.'<tr>';
- foreach($podaci['pod'] as $key=>$val)
- {
- $mbr='<a href="uredi.php?mbr='.$val['mbrStud'].
- '&broj='.$podaci['broj'].'">'.$val['mbrStud'].'</a>';
- $podaci['y']=$podaci['y']+1;
- echo '<tr><td>'.$podaci['y'].'<td>'.
- $val['imeStud'].'<td>'.
- $val['prezStud'].'<td>'.
- $mbr.'<tr>';
- }
- echo '</table>';
- if($podaci['broj']<$podaci['total'])
- {
- echo '<a href="index.php?broj='.($podaci['broj']+1).'">'.
- 'Naprijed'.'</a>'.'<br>';
- }
- else
- {
- echo '<a href="index.php">'.'Naprijed'.'</a>'.'<br>';
- }
- for($x=1;$x<=$podaci['total'];$x=$x+1)
- {
- echo '<a href="index.php?broj='.$x.'">'.$x.'</a>|';
- }
- if($podaci['broj']>1)
- {
- echo '<br>'.'<a href="index.php?broj='.($podaci['broj']-1).'">'.
- 'Natrag'.'</a>'.'<br>';
- }
- else
- {
- echo '<br>'.'<a href="index.php">'.'Natrag'.'</a>'.'<br>';
- }
- }
- }
- 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();
- // put your code here
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment