function unesi($i, $o, $c) { include 'baza.php'; $b = new baza(); $mysqli = $b->konektuj(); //upper case first $i = ucfirst($i); $o = ucfirst($o); //dal ima greske if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } $query = "INSERT INTO tereni VALUES ('LAST_INSERT_ID()', '{$i}', '{$o}', {$c})"; $mysqli->query($query); printf("Unet je teren sa brojem: ", $mysqli->insert_id); $mysqli->close(); }
function ucitajTerene() { if (isset($_GET['ord'])) { $order = $_GET['ord']; } else { $order = ""; } include 'baza.php'; $b = new baza(); $mysqli = $b->konektuj(); echo '<table class="table table-hover table-condensed table-bordered" id="levaX">'; echo '<tr class="active"><th>Broj terena</th><th>Naziv</th><th>Opština</th><th>Cena</th>'; // $order = "cena_termina"; if ($order === "") { $query = "SELECT * FROM tereni"; } else { if ($order === "cena_termina") { $query = "SELECT * FROM tereni ORDER BY {$order} DESC"; } else { $query = "SELECT * FROM tereni ORDER BY {$order} ASC"; } } $result = $mysqli->query($query); $i = 1; while ($row = $result->fetch_row()) { //svaki teren svoj broj echo '<tr class="danger"><td>'; echo $i; echo '</td>'; echo '<td id="teren' . $i . '">' . $row[1] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '<td data-type="text" data-placement="right" data-title="Enter username" id="cenaX' . $i . '">' . $row[3] . '</td>'; $i++; } echo "</table>"; }
<h2>Rezultati takmičenja</h2> <hr class="star-primary"> </div> </div> <div class="row"> <div class="col-md-4"> <div id="levaT"> <h4><span class="label label-primary">Prva grupa</span></h4> </div> <?php include 'baza.php'; $b = new baza(); $mysqli = $b->konektuj(); $query = "SELECT * FROM zapad ORDER BY Broj_poena desc, Gem_razlika desc"; //rezultat pretrage $result = $mysqli->query($query); echo '<table class="table table-hover table-condensed table-bordered" id="leva">'; echo '<tr class="active"><th>Mesto</th><th>Takmičar</th><th>Broj mečeva</th><th>Gem razlika</th><th>Broj poena</th></tr>'; //ISPISIVANJE ZAPAD tabele $i = 1; while ($row = $result->fetch_row()) { if ($i <= 4) { echo '<tr class="danger"><td>'; echo $i; echo '</td>'; echo '<td>'; echo $row[2]; echo '</td>';