Zobrazení žáků na stránce vid.81
This commit is contained in:
parent
8f6b18ad99
commit
8bea73bdd6
@ -2,8 +2,8 @@
|
||||
|
||||
?>
|
||||
|
||||
<DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html lang="cs">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
<main>
|
||||
<section>
|
||||
|
||||
<a href="zaci.php">Seznam všech žáků</a>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
@ -10,6 +10,41 @@ if (mysqli_connect_error()) {
|
||||
exit();
|
||||
}
|
||||
|
||||
echo "Úspěšné přihlášení do databáze";
|
||||
//echo "Úspěšné přihlášení do databáze";
|
||||
|
||||
?>
|
||||
$sql = "SELECT * FROM student";
|
||||
//echo "<br>";
|
||||
$result = mysqli_query($connection, $sql);
|
||||
//var_dump($result);
|
||||
//echo "<br>";
|
||||
$students = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
||||
//var_dump($students);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="cs">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Seznam žáků školy</h1>
|
||||
<?php
|
||||
if(empty($students)):
|
||||
?>
|
||||
<p>Žádní žáci nebyli nalezeni</p>
|
||||
|
||||
<?php else: ?>
|
||||
<ul>
|
||||
<?php foreach ($students as $one_student): ?>
|
||||
<li><?php echo $one_student["first_name"]. " " .$one_student["second_name"] ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<a href="index.php">Zpět na hlavní stranu</a>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user