Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>
- Sprawdzian PHP
- </title>
- </head>
- <body>
- <?php
- $polaczenie=@new mysqli('localhost', 'root', '', 'szkola');
- if (mysqli_connect_errno() != 0) //funkcja zwraca numer bΕedu zwraca 0 gdy nie ma bledu
- {
- echo '<p> Wystapil blad polaczenia: '.mysqli_connect_error() . '</p>';
- }
- else
- {
- print('Poloczono z baza...');
- $wynik=$polaczenie->query('Select nazwisko from uczniowie');
- if ($wynik->num_rows > 0) {
- // output data of each row
- while($row = $wynik->fetch_assoc())
- {
- echo "<tr><td><br>".$row["nazwisko"]."</td></tr>";
- }
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement