You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.1 KiB
93 lines
3.1 KiB
<?php
|
|
require "init.php";
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Ukazka k php</h1>
|
|
<a href="/search.php" class="btn btn-primary">Vyhledavani</a>
|
|
<a href="/" class="btn btn-primary">Home</a>
|
|
<a href="/write.php" class="btn btn-primary">Write</a>
|
|
<br>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
// selectovani dat z tabulky
|
|
$sql = "SELECT * FROM mock_data_doucko"; // LIMIT 30 OFFSET " . 30*3;
|
|
$result = mysqli_query($conn, $sql);
|
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
// vypis pro tabulku pokud neni prázdná
|
|
echo '<table class="table">';
|
|
echo "<thead>";
|
|
echo " <tr>";
|
|
echo ' <th scope="col">#</th>';
|
|
echo ' <th scope="col">First</th>';
|
|
echo ' <th scope="col">Last</th>';
|
|
echo ' <th scope="col">E-mail</th>';
|
|
echo ' <th scope="col">Gender</th>';
|
|
echo ' <th scope="col">IP-adress</th>';
|
|
echo ' <th scope="col">status</th>';
|
|
echo " </tr>";
|
|
echo "</thead>";
|
|
echo "<tbody>";
|
|
;
|
|
|
|
//vypis pro každý záznam
|
|
while($row = mysqli_fetch_assoc($result)) {
|
|
// echo $row["id"];
|
|
echo "<tr>";
|
|
echo '<th scope="row">'.$row["id"].'</th>';
|
|
echo "<td>". $row["first_name"] . "</td>";
|
|
echo "<td>". $row["last_name"] . "</td>";
|
|
echo "<td>". $row["email"] . "</td>";
|
|
|
|
//echo "<td>". $row["gender"] . "</td>";
|
|
if ($row["gender"] != "Male" && $row["gender"] != "Female") {
|
|
echo '<td class="table-primary">'. $row["gender"] . "</td>";
|
|
} else {
|
|
echo "<td>". $row["gender"] . "</td>";
|
|
}
|
|
|
|
echo "<td>". $row["ip_address"] . "</td>";
|
|
|
|
// echo "<td>". $row["status"] . "</td>";
|
|
if ($row["status"] == "Available") {
|
|
echo '<td class="table-success">'. $row["status"] . "</td>";
|
|
}
|
|
elseif ($row["status"] == "do not distrurb") {
|
|
echo '<td class="table-danger">'. $row["status"] . "</td>";
|
|
}
|
|
elseif ($row["status"] == "busy") {
|
|
echo '<td class="table-warning">'. $row["status"] . "</td>";
|
|
}
|
|
elseif ($row["status"] == "offline") {
|
|
echo '<td class="table-dark">'. $row["status"] . "</td>";
|
|
} else {
|
|
echo "<td>". $row["status"] . "</td>";
|
|
}
|
|
|
|
echo"</tr>";
|
|
}
|
|
echo " </tbody>
|
|
</table>";
|
|
} else {
|
|
echo "0 results";
|
|
}
|
|
|
|
mysqli_close($conn);
|
|
?>
|
|
</div>
|
|
<script src="js/bootstrap.bundle.js"></script>
|
|
</body>
|
|
</html>
|