19.03
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 596 KiB |
5515
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/baza.sql
Normal file
5515
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/baza.sql
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/import.png
Normal file
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/import.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 374 KiB |
41
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/index.php
Normal file
41
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/index.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
$db = mysqli_connect('localhost', 'root', '', 'biblioteka');
|
||||||
|
if (!$db) {
|
||||||
|
die("Connection failed: " . mysqli_connect_error());
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Kwerenda 4</title>
|
||||||
|
<style>td, th, table { border: 1px black solid; border-collapse: collapse}</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>Kwerenda 4</h2>
|
||||||
|
<p>Kwerenda: <code>SELECT autor, tytul, kod FROM ksiazki ORDER BY RAND() LIMIT 5;</code></p>
|
||||||
|
<?php
|
||||||
|
$query = "SELECT autor, tytul, kod FROM ksiazki ORDER BY RAND() LIMIT 5;";
|
||||||
|
|
||||||
|
$result = mysqli_query($db, $query);
|
||||||
|
if (mysqli_num_rows($result) != 0) {
|
||||||
|
echo "<table>";
|
||||||
|
echo "<tr><th>Autor</th><th>Tytul</th><th>Kod</th></tr>";
|
||||||
|
while ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>" . $row['autor'] . "</td><td>" . $row['tytul'] . "</td><td>" . $row['kod'] . "</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
} else {
|
||||||
|
echo "Brak wyników.";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
mysqli_close($db);
|
||||||
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw1.png
Normal file
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 418 KiB |
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw2.png
Normal file
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 408 KiB |
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw3.png
Normal file
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 346 KiB |
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw4.png
Normal file
BIN
Egzamin/inf_03_2025_06_03_php_wiedzamin_BAZA/kw4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 422 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
SELECT nazwisko, imie, klasa, data_wypozyczenia FROM uczniowie WHERE data_wypozyczenia > "2020-03-02";
|
||||||
|
SELECT nazwisko, imie, data_wypozyczenia, autor, kod FROM uczniowie JOIN ksiazki ON ksiazki.id = uczniowie.id_ksiazki;
|
||||||
|
DELETE FROM ksiazki WHERE autor = "0";
|
||||||
|
SELECT autor, tytul, kod FROM ksiazki ORDER BY RAND() LIMIT 5;
|
||||||
Reference in New Issue
Block a user