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
- require 'konekcija.php';
- if(isset($_GET['dvorana']))
- {
- $dvorana=$_GET['dvorana'];
- $query="select r.oznDvorana,r.oznVrstadan,r.sat,p.nazPred
- from rezervacija r
- left outer join pred p
- on p.sifPred=r.sifPred
- where r.ozndvorana='$dvorana'
- order by case r.oznvrstaDan
- when 'PO' then 1
- when 'UT' then 2
- when 'SR' then 3
- when 'CE' then 4
- when 'PE' then 5
- when 'SU' then 6
- when 'NE' then 7
- end,r.sat";
- $result= mysqli_query($link, $query);
- $numRows= mysqli_num_rows($result);
- if($numRows==0)
- {
- echo '<a href="index.php">'.'<i><b>'.'Natrag'.'</i></b>'.'</a>'.'<br>';
- echo 'Za trazenu dvoranu naziva '.'<i><b>'.$dvorana.'</i></b>'
- .' nema rezerviranih termina'.'<br>';
- }
- else
- {
- echo '<a href="index.php">'.'<i><b>'.'Natrag'.'</i></b>'.'</a>'.'<br>';
- echo '<table border="2">';
- echo '<tr><th>'.''.'<th>'.
- 'Dvorana'.'<th>'.
- 'Dan'.'<th>'.
- 'Vrijeme'.'<th>'.
- 'Predavanje'.'<tr>';
- $x=0;
- while($row= mysqli_fetch_assoc($result))
- {
- switch($row['oznVrstadan'])
- {
- case 'PO':
- $dan='Ponedjeljak';
- break;
- case 'UT':
- $dan='Utorak';
- break;
- case 'SR':
- $dan='Srijeda';
- break;
- case 'CE':
- $dan='Četvrtak';
- break;
- case 'PE':
- $dan='Petak';
- break;
- default:
- $dan=$row['oznVrstadan'];
- }
- $x=$x+1;
- echo '<tr><td>'.$x.'<td>'.
- $row['oznDvorana'].'<td>'.
- $dan.'<td>'.
- vrijeme($row['sat']).'<td>'.
- $row['nazPred'].'<tr>';
- }
- }
- echo '</table>';
- }
- #ako se pristupa bez superglobale u linku
- else
- {
- header('location:index.php');
- }
- #prostor za funkcije
- function vrijeme($subject)
- {
- $novo= mktime($subject,0);
- return date('H:i',$novo);
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement