This commit is contained in:
spili 2025-09-22 14:35:26 +02:00
commit ed7f4d5fe8
5 changed files with 91 additions and 0 deletions

BIN
baner.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

16
get.php Normal file
View File

@ -0,0 +1,16 @@
<?php
$pol = mysqli_connect("localhost", "root","", "szkolenia");
$kw = mysqli_query($pol, "SELECT nazwa,cena 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
View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kursy programowania</title>
<script src="script.js" defer></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<img src="baner.jpg">
</header>
<nav>
<a href="index.html">Strona główna</a>
<a href="raty.html">Zamów kursy</a>
<a href="https://google.com">Skontaktuj nas</a>
</nav>
<table id="tab"></table>
<h2>Jesteśmy tutaj w Warszawie :p</h2>
<footer>Strone zrobił: Sklo</footer>
</body>
</html>

9
script.js Normal file
View 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.cena}</td></tr>`
).join("");
})

39
style.css Normal file
View File

@ -0,0 +1,39 @@
body{
margin: 0px;
padding: 0px;
}
img{
margin: 0px;
padding: 0px;
width: 100%;
}
nav, footer{
text-align: center;
background-color: #625B5B;
padding: 20px;
color: white;
}
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 double #625B5B;
width: 60%;
margin-left: 40px;
text-align: center;
}