<!DOCTYPE HTML>
<!--
	Massively by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
	<head>
		<title>164273</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
		<link rel="stylesheet" href="assets/css/main.css" />
		<noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript>
	</head>
	<body class="is-preload">

		<!-- Wrapper -->
			<div id="wrapper">

				<!-- Header -->
					<header id="header">
						<a href="index.php" class="logo">Stanislav Hajný</a>
					</header>

				<!-- Nav -->
					<nav id="nav">
						<ul class="links">
							<li><a href="index.php">O mně</a></li>
							<li class="active"><a href="generic.php">Naměřená data</a></li>
							</ul>
						<ul class="icons">
							<li><a href="https://twitter.com" class="icon brands fa-twitter"><span class="label">Twitter</span></a></li>
							<li><a href="https://facebook.com" class="icon brands fa-facebook-f"><span class="label">Facebook</span></a></li>
							<li><a href="https://instagram.com" class="icon brands fa-instagram"><span class="label">Instagram</span></a></li>
							<li><a href="https://github.com" class="icon brands fa-github"><span class="label">GitHub</span></a></li>
						</ul>
					</nav>

				<!-- Main -->
					<div id="main">
					
					

<?php
						
					// pripojeni k DB serveru a uložení relace do proměnné
					$spojeni = mysqli_connect("sql.endora.cz:3310", "esp32", "35P32_door", "doorsql");
					if (!$spojeni) die("Nepodařilo se připojit k DB serveru: " . mysqli_connect_error());
					
					// vytvoření dotazu: Výpis celé tabulky
					$dotaz = "SELECT * FROM SensorData";
				
					
					// mysqli_query odešle dotaz na DB server, vráti dvojrozměrné pole dat
					$data = mysqli_query($spojeni, $dotaz);

			
					echo "<p>Výpis naměřených dat:</p>";
					echo "<p><table class='zkousky'>";
					echo "<tr>
							<th>ID</th> <th>optický sensor</th> <th>Lokace</th> <th>hodnota č.1</th> <th>hodnota č.2</th> <th>hodnotač .3</th> <th>čas zápisu do DB</th>
						  </tr>";
					
					// pole dat vyčteme po jednom řádku pomocí cyklu while
					while ($radek = mysqli_fetch_array($data, MYSQLI_ASSOC)){
						echo "<tr>";
						echo "<td>".$radek['id']."</td>";
						echo "<td>".$radek['sensor']."</td>";
						echo "<td>".$radek['location']."</td>";
						echo "<td>".$radek['value1']."</td>";
						echo "<td>".$radek['value2']."</td>";
						echo "<td>".$radek['value3']."</td>";
						echo "<td>".$radek['reading_time']."</td>";
						echo "</tr>";
					}
					
					echo "</table></p>";
					

			
					// ukončíme spojení s DB serverem
					mysqli_close($spojeni);
					
?>

		</div>
	</div>
				

				<!-- Copyright -->
					<div id="copyright">
						<ul><li>&copy; Untitled</li><li>Design: <a href="https://html5up.net">HTML5 UP</a></li></ul>
					</div>

			</div>

		<!-- Scripts -->
			<script src="assets/js/jquery.min.js"></script>
			<script src="assets/js/jquery.scrollex.min.js"></script>
			<script src="assets/js/jquery.scrolly.min.js"></script>
			<script src="assets/js/browser.min.js"></script>
			<script src="assets/js/breakpoints.min.js"></script>
			<script src="assets/js/util.js"></script>
			<script src="assets/js/main.js"></script>

	</body>
</html>