zaliczenie
This commit is contained in:
commit
e9e0c414cc
17
get.php
Normal file
17
get.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$pol = mysqli_connect("localhost", "root", "", "szkolenia");
|
||||||
|
|
||||||
|
$kw = mysqli_query($pol, "SELECT nazwa, cena, czas_trwania FROM kursy ORDER BY id");
|
||||||
|
|
||||||
|
$json = array();
|
||||||
|
|
||||||
|
while($row = mysqli_fetch_assoc($kw)) {
|
||||||
|
$json[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
mysqli_close($pol);
|
||||||
|
|
||||||
|
echo json_encode($json);
|
||||||
|
|
||||||
|
?>
|
||||||
30
i1.html
Normal file
30
i1.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Kursy komputerowe</title>
|
||||||
|
<link rel="stylesheet" href="layout.css">
|
||||||
|
<script src="script.js" defer> </script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img src="baner.png">
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<a>Strona główna</a>
|
||||||
|
<a>szymon p</a>
|
||||||
|
<a>rzodkiewka</a>
|
||||||
|
<a>Kamil S</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<table id="tab">
|
||||||
|
</table>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
rzodkiewek pyk pyk pyk
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
39
layout.css
Normal file
39
layout.css
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
body {
|
||||||
|
font-family: Helvetica;
|
||||||
|
background-color: #EAEAEA;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav, footer {
|
||||||
|
background-color: #625B5B;
|
||||||
|
color: white;
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a {
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #EAEAEA;
|
||||||
|
color: #625B5B;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 50px;
|
||||||
|
border-radius: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 1px solid #625B5B;
|
||||||
|
width: 60%;
|
||||||
|
margin-left: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
9
script.js
Normal file
9
script.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
fetch('get.php')
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(data => {
|
||||||
|
const table = document.getElementById('tab');
|
||||||
|
table.innerHTML = `<tr><th>Kurs</th><th>Czas trwania</th><th>Cena</th>` +
|
||||||
|
data.map($row => `<tr><td>${$row.nazwa}</td><td>${$row.czas_trwania}</td><td>${$row.cena}</td></tr>`).join('');
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user