mirror of
https://github.com/FlyInTheBox/31TSAI.git
synced 2024-12-22 22:37:00 +01:00
a
This commit is contained in:
parent
ce65a8e453
commit
e05997cbff
5 changed files with 60 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
<?php
|
<?php
|
||||||
$query = 'SELECT * FROM czytelnicy';
|
$query = 'SELECT * FROM czytelnicy';
|
||||||
$result = mysqli_query($conn, $query);
|
$result = mysqli_query($conn, $query);
|
||||||
|
echo '<p>Zawiera ' . mysqli_num_rows($result) . ' wierszy</p>';
|
||||||
if (mysqli_num_rows($result) > 0) {
|
if (mysqli_num_rows($result) > 0) {
|
||||||
echo '<table>';
|
echo '<table>';
|
||||||
echo '<tr><th>Numer czytelnika</th><th>Imię i nazwisko</th><th>Data_ur</th><th>Ulica</th><th>Kod</th><th>Miasto</th><th>Data_zapisania</th></tr>';
|
echo '<tr><th>Numer czytelnika</th><th>Imię i nazwisko</th><th>Data_ur</th><th>Ulica</th><th>Kod</th><th>Miasto</th><th>Data_zapisania</th></tr>';
|
||||||
|
|
|
@ -1 +1,18 @@
|
||||||
<h1>Tabela działy</h1>
|
<h1>Tabela działy</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$query = 'SELECT * FROM dzialy';
|
||||||
|
$result = mysqli_query($conn, $query);
|
||||||
|
echo '<p>Zawiera ' . mysqli_num_rows($result) . ' wierszy</p>';
|
||||||
|
if (mysqli_num_rows($result) > 0) {
|
||||||
|
echo '<table>';
|
||||||
|
echo '<tr><th>Id_dzial</th><th>Nazwa</th><th><a class="add" href="?PAGE=dzialy_dodaj">✚</a></th></tr>';
|
||||||
|
while ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
echo '<tr><td>' . $row['Id_dzial'] . '</td><td>'
|
||||||
|
. $row['Nazwa'] . '</td><td><a href="dzialy_dodaj.php">edycja </a></td></tr>';
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
} else {
|
||||||
|
echo 'brak danych';
|
||||||
|
}
|
||||||
|
?>
|
19
Biblioteka 17.05.2023/pages/dzialy_dodaj.php
Normal file
19
Biblioteka 17.05.2023/pages/dzialy_dodaj.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<h1>Nowe dane tabeli działy</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") // Zapisz dane z formularza do bazy [INSERT]
|
||||||
|
{
|
||||||
|
$Id_dzial = $_POST['Id_dzial'];
|
||||||
|
$Nazwa = $_POST['Nazwa'];
|
||||||
|
$query = "INSERT INTO dzialy (Id_dzial, Nazwa) values ('".$Nazwa."')";
|
||||||
|
$result = mysqli_query($conn, $query);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo '<form action="?PAGE=dzialy_dodaj" method="post">
|
||||||
|
<table>
|
||||||
|
<tr><td>Id_dzial</td><td><input type="text" name="Id_dzial" id="Id_dzial" disabled></td></tr>
|
||||||
|
<tr><td>Nazwa</td><td><input type="text" name="Nazwa" id="Nazwa"></td></tr>
|
||||||
|
<tr><td colspan="2" style="text-align: center"><button type="submit">Zapisz</button></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>';}
|
||||||
|
?>
|
|
@ -1 +1,20 @@
|
||||||
<h1>Tabela pracownicy</h1>
|
<h1>Tabela pracownicy</h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$query = 'SELECT * FROM pracownicy JOIN stanowiska ON pracownicy.Id_stanowisko = stanowiska.Id_stanowisko';
|
||||||
|
$result = mysqli_query($conn, $query);
|
||||||
|
echo '<p>Zawiera ' . mysqli_num_rows($result) . ' wierszy</p>';
|
||||||
|
if (mysqli_num_rows($result) > 0) {
|
||||||
|
echo '<table>';
|
||||||
|
echo '<tr><th>Id_pracownika</th><th>Nazwisko</th><th>Imie</th><th>Stanowisko</th><th>Miasto</th><th>Data_Zatrudnienia</th><th>Wynagrodzenie</th></tr>';
|
||||||
|
while ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
echo '<tr><td>' . $row['Id_pracownika'] . '</td><td>'
|
||||||
|
. $row['Nazwisko'] . '</td><td>' . $row['Imie'] . '</td><td>' . $row['Nazwa'] . '</td><td>' . $row['Miasto'] . '</td><td>' . $row['Data_zatrudnienia'] . '</td><td>' . $row['Wynagrodzenie'] . '</td></tr>';
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
} else {
|
||||||
|
echo 'brak danych';
|
||||||
|
}
|
||||||
|
?>
|
|
@ -43,3 +43,6 @@ tr, td, th {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
table {border-collapse: collapse}
|
table {border-collapse: collapse}
|
||||||
|
.add {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
Loading…
Reference in a new issue