Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8">
- <title>Dziennik szkolny</title>
- <meta http-equiv="X-Ua-Compatible" content="IE=edge">
- <link rel="stylesheet" href="main.css">
- </head>
- <body>
- <form action="index.php" method="post">
- </form>
- <?php
- if(isset($_POST["klient"]))
- {
- if(empty($_POST["klient"]))
- {
- echo '<span style="color:yellow;">Nie podano nazwy klasy!</span>';
- }
- else
- {
- require_once "connect.php";
- $conn = mysqli_connect($host, $user, $pass, $db) or die("Błąd połączenia!");
- mysqli_set_charset($conn, "utf8");
- $klient = $_POST["klient"];
- $q = "SELECT Imie, Nazwisko FROM klient";
- $result = mysqli_query($conn, $q) or die("Problemy z odczytem danych!");
- $ile = mysqli_num_rows($result);
- if($ile == 0)
- {
- echo '<span style="color:red;">Nie ma takiej klasy w szkole!</span>';
- }
- else
- {
- echo<<<END
- <table>
- <thead>
- <tr>
- <th>Imię</th>
- <th>Nazwisko</th>
- </tr>
- </thead>
- <tbody>
- END;
- $suma = 0;
- while($row = mysqli_fetch_assoc($result))
- {
- echo "\r\n\t\t\t<tr>";
- foreach($row as $col)
- {
- echo "<td>$col</td>";
- }
- echo "</tr>";
- //echo "\r\n\t\t\t<tr><td>".$row['Imie']."</td><td>".$row['Nazwisko']."</td></tr>";
- }
- echo<<<END
- \r\n
- </tbody>
- </table>
- END;
- }
- mysqli_close($conn);
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement