zaliczone
This commit is contained in:
commit
0bf3e5cd85
15
get.php
Normal file
15
get.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?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)
|
||||||
|
|
||||||
|
?>
|
||||||
27
index.html
Normal file
27
index.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Kursy komputerowe</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<script src="script.js" defer> </script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<img src="baner.png">
|
||||||
|
</header>
|
||||||
|
<nav>
|
||||||
|
<a href="">strona główna</a>
|
||||||
|
<a href=""> cos wiecej</a>
|
||||||
|
<a href=""> cos jeszcze wiecej </a>
|
||||||
|
</nav>
|
||||||
|
<br>
|
||||||
|
<table id="tab">
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<p>super strona by tomasz</p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
9
script.js
Normal file
9
script.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', async() => {
|
||||||
|
const res = await fetch('get.php');
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
const t = document.getElementById('tab');
|
||||||
|
t.innerHTML = t.rows[0]?.outerHTML + data.map(r =>
|
||||||
|
`<tr><td>${r.nazwa}</td><td>${r.czas_trwania}</td><td>${r.cena}</td></tr>`
|
||||||
|
).join("");
|
||||||
|
})
|
||||||
59
style.css
Normal file
59
style.css
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
body {
|
||||||
|
font-family: Helvetica;
|
||||||
|
background-color: #EAEAEA;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
header img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
color: white;
|
||||||
|
font-size: 48px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a:hover {
|
||||||
|
background-color: #625B5B;
|
||||||
|
color: #EAEAEA;
|
||||||
|
border: 1px solid #EAEAEA;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 1px dashed #625B5B;
|
||||||
|
width: 60%;
|
||||||
|
margin-left: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user