Advertisement
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['mbr']))
- {
- $mbr=$_GET['mbr'];
- $prosjek=$_GET['prosjek'];
- }
- else
- {
- header('location:index.php');
- }
- $query="select p.nazPred,o.ocjena
- from ocjene o
- left outer join pred p
- on o.sifPred=p.sifPred
- where o.mbrStud=$mbr";
- $result=mysqli_query($link,$query);
- while($row=mysqli_fetch_assoc($result))
- {
- $pod[]=array( 'ocjena'=>$row['ocjena'],
- 'nazPred'=>$row['nazPred']);
- }
- $query2="select imeStud,prezStud from ucenici
- where mbrStud=$mbr";
- $result2=mysqli_query($link,$query2);
- $fetch=mysqli_fetch_assoc($result2);
- $x=0;
- $p=array('pod'=>$pod,
- 'mbr'=>$mbr,
- 'prosjek'=>$prosjek,
- 'fetch'=>$fetch,
- 'x'=>$x);
- return $p;
- }
- }
- class view
- {
- function ispisPodataka($p)
- {
- echo '<a href="index.php">'.'Natrag'.'</a>'.'<br>';
- echo '<table border="0">'.
- '<tr><td>'.'Ime:'.'<td>'.$p['fetch']['imeStud'].'<tr>'.
- '<tr><td>'.'Prezime:'.'<td>'.$p['fetch']['prezStud'].'<tr>'.
- '<tr><td>'.'Prosjek:'.'<td>'.$p['prosjek'].'<tr>'.
- '</table>';
- echo '<table border="2">';
- echo '<tr><th>'.''.'<th>'.'Predavanje'.'<th>'.'Ocjena'.'<tr>';
- foreach($p['pod'] as $key=>$val)
- {
- $p['x']=$p['x']+1;
- echo '<tr><td>'.$p['x'].'<td>'.
- $val['nazPred'].'<td>'.
- $val['ocjena'].'<tr>';
- }
- echo '</table>';
- }
- }
- class controler
- {
- public $_Model;
- public $_View;
- function __construct()
- {
- $this->_Model=new model();
- $this->_View=new view();
- }
- function start()
- {
- $p= $this->_Model->pohranaPodataka();
- $this->_View->ispisPodataka($p);
- }
- }
- $pokreni=new controler();
- $pokreni->start();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement