PHP_DS_Project/www2databaze/jeden-zak.php

48 lines
1.2 KiB
PHP
Raw Normal View History

2024-09-24 15:48:46 +00:00
<?php
global $connection;
2024-09-25 15:40:03 +00:00
require "assets/database.php";
2024-09-24 15:48:46 +00:00
if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
$sql = "SELECT * FROM student WHERE id = ". $_GET["id"];
$result = mysqli_query($connection, $sql);
if ($result === false) {
echo mysgli_error($connection);
} else {
$students = mysqli_fetch_assoc($result);
}
}
?>
<!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>
2024-09-25 15:40:03 +00:00
<?php require "assets/header.php" ?>
2024-09-24 15:48:46 +00:00
<main>
2024-09-25 15:40:03 +00:00
<section class="main-heading"><h1>Informace o žákovi</h1></section>
2024-09-24 15:48:46 +00:00
<section>
<?php if ($students === null): ?>
<p>Žák nenalezen</p>
<?php else : ?>
<h2><?php echo $students["first_name"]. " " .$students["second_name"] ?></h2>
<p>Věk: <?php echo $students["age"] ?></p>
<p>Dodatečné informace: <?= $students["life"] ?></p>
2024-09-25 15:40:03 +00:00
<p>Kolej: <?= $students["college"] ?></p>
2024-09-24 15:48:46 +00:00
<?php endif ?>
</section>
</main>
2024-09-25 15:40:03 +00:00
<?php require "assets/footer.php" ?>
2024-09-24 15:48:46 +00:00
</body>
</html>