mirror of
https://github.com/FlyInTheBox/31TSAI.git
synced 2024-11-09 20:44:11 +01:00
a
This commit is contained in:
parent
fdb17b4ba7
commit
ce65a8e453
4 changed files with 56 additions and 2 deletions
|
@ -1 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
$servername = 'localhost';
|
||||||
|
$database = 'wylazowskiw';
|
||||||
|
$username = 'wylazowskiw';
|
||||||
|
$password = 'password1$';
|
||||||
|
$mysqliProceduralConection = mysqli_connect($servername, $username, $password, $database);
|
||||||
|
|
||||||
|
if (!$mysqliProceduralConection)
|
||||||
|
{
|
||||||
|
die("Próba połączenia z bazą danych zakończyła się niepowodzeniem. Błąd: "
|
||||||
|
. mysqli_connect_error());
|
||||||
|
}
|
||||||
|
echo '<p>Połączono z bazą danych <b>' . $database . '</b> na serwerze <b>' . $servername . '</b><br>';
|
||||||
|
echo 'Host info: ' . $mysqliProceduralConection->host_info . '<br>';
|
||||||
|
echo 'MySQLi stat: ' . mysqli_stat($mysqliProceduralConection) . '</p>';
|
||||||
|
|
||||||
|
mysqli_close($mysqliProceduralConection);
|
||||||
|
?>
|
|
@ -9,7 +9,19 @@
|
||||||
<link rel="stylesheet" href="style/style.css">
|
<link rel="stylesheet" href="style/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<?php
|
||||||
|
$servername = 'localhost';
|
||||||
|
$database = 'wylazowskiw';
|
||||||
|
$username = 'wylazowskiw';
|
||||||
|
$password = 'password1$';
|
||||||
|
$conn = mysqli_connect($servername, $username, $password, $database);
|
||||||
|
if (!$conn)
|
||||||
|
{
|
||||||
|
die('Próba połączenia z bazą danych zakończyła się niepowodzeniem. Błąd: '
|
||||||
|
. mysqli_connect_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
<nav>
|
<nav>
|
||||||
<a class="linki" href="?PAGE=mainpage">Strona główna</a>
|
<a class="linki" href="?PAGE=mainpage">Strona główna</a>
|
||||||
<a class="linki" href="?PAGE=db_conn">Test Połączenia</a>
|
<a class="linki" href="?PAGE=db_conn">Test Połączenia</a>
|
||||||
|
@ -30,6 +42,8 @@
|
||||||
if (isset($_GET['PAGE'])) {
|
if (isset($_GET['PAGE'])) {
|
||||||
if (file_exists('pages/' . $_GET['PAGE'] . '.php'))
|
if (file_exists('pages/' . $_GET['PAGE'] . '.php'))
|
||||||
include('pages/' . $_GET['PAGE'] . '.php');
|
include('pages/' . $_GET['PAGE'] . '.php');
|
||||||
|
else if (file_exists('include/' . $_GET['PAGE'] . '.php'))
|
||||||
|
include('include/' . $_GET['PAGE'] . '.php');
|
||||||
else
|
else
|
||||||
echo '<h2>Ta strona nie istnieje</h2>';
|
echo '<h2>Ta strona nie istnieje</h2>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,19 @@
|
||||||
<h1>Tabela czytelnicy</h1>
|
<h1>Tabela czytelnicy</h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$query = 'SELECT * FROM czytelnicy';
|
||||||
|
$result = mysqli_query($conn, $query);
|
||||||
|
if (mysqli_num_rows($result) > 0) {
|
||||||
|
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>';
|
||||||
|
while ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
echo '<tr><td>' . $row['Nr_czytelnika'] . '</td><td>'
|
||||||
|
. $row['Imie'] . ' ' . $row['Nazwisko'] . '</td><td>' . $row['Data_ur'] . '</td><td>' . $row['Ulica'] . '</td><td>' . $row['Kod'] . '</td><td>' . $row['Miasto'] . '</td><td>' . $row['Data_zapisania'] . '</td></tr>';
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
} else {
|
||||||
|
echo 'brak danych';
|
||||||
|
}
|
||||||
|
?>
|
|
@ -37,4 +37,9 @@ nav {
|
||||||
.linki:hover{
|
.linki:hover{
|
||||||
background-color: chocolate;
|
background-color: chocolate;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
tr, td, th {
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
table {border-collapse: collapse}
|
Loading…
Reference in a new issue