<?php
function databaseconnect(){
   $db = new mysqli("localhost", "root", "", "nemocnice");
   $db->set_charset("utf8");
   if ($db->connect_error) {
         die("Connection failed: " . $db->connect_error);
   }
   return $db;
}
function displayPanels(){
     $db= databaseconnect();
     $sql = "SELECT * FROM panely ORDER BY nazev";
     if($r = mysqli_query($db, $sql)){
          while ($row = mysqli_fetch_array($r)){
               echo "<option value=". $row["id"] .">". $row["panelIP"] .", ". $row["nazev"] ."</option>";
          }
     }
}
function displayWiFi(){
     $db= databaseconnect();
     $sql = "SELECT * FROM wifi ORDER BY nazev";
     if($r = mysqli_query($db, $sql)){
          while ($row = mysqli_fetch_array($r)){
               echo "<option value=". $row["id"] .">". $row["nazev"] ."</option>";
          }
     }
}
?>