feat: add database integration and dynamic product listing
Co-authored-by: aider (openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
parent
3ea70349df
commit
2e8961f0cb
13
config/database.php
Normal file
13
config/database.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$host = 'localhost';
|
||||
$dbname = 'shoe_store'; // Replace with your database name
|
||||
$username = 'root'; // Replace with your database username
|
||||
$password = ''; // Replace with your database password
|
||||
|
||||
try {
|
||||
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8", $username, $password);
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch (PDOException $e) {
|
||||
die("Database connection failed: " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
55
i1.html
55
i1.html
@ -2,53 +2,60 @@
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Kursy komputerowe</title>
|
||||
<title>Sklep z obuwiem</title>
|
||||
<link rel="stylesheet" href="css/layout.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<img src="imgs/baner.png" alt="kursy komputerowe">
|
||||
<div class="header-text">Kursy komputerowe</div>
|
||||
<img src="imgs/baner.png" alt="sklep z obuwiem">
|
||||
<div class="header-text">Sklep z obuwiem</div>
|
||||
</header>
|
||||
|
||||
|
||||
<nav>
|
||||
<a href="i1.html">Strona główna</a>
|
||||
<a href="i1.php">Strona główna</a>
|
||||
<a href="raty.html">Koszt rat</a>
|
||||
<a href="https://moje-szkolenia.pl/">Nasz partner</a>
|
||||
</nav>
|
||||
|
||||
<main>
|
||||
<h3>Kursy komputerowe - programowanie</h3>
|
||||
<h3>Oferta obuwia</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Kurs</th>
|
||||
<th>Czas trwania</th>
|
||||
<th>Model</th>
|
||||
<th>Kategoria</th>
|
||||
<th>Cena</th>
|
||||
<th>Opis</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>React.js</td>
|
||||
<td>4 miesiące</td>
|
||||
<td>1500 zł</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>JavaScript</td>
|
||||
<td>3 miesiące</td>
|
||||
<td>1200 zł</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HTML + CSS</td>
|
||||
<td>2 miesiące</td>
|
||||
<td>800 zł</td>
|
||||
</tr>
|
||||
<?php
|
||||
require_once 'config/database.php';
|
||||
|
||||
try {
|
||||
$stmt = $pdo->query("
|
||||
SELECT b.model, k.nazwa_kat, b.nazwa, b.cena, b.opis
|
||||
FROM obuwie_buty b
|
||||
JOIN obuwie_kategorie k ON b.id_kat = k.id_kat
|
||||
");
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
echo "<tr>";
|
||||
echo "<td>" . htmlspecialchars($row['nazwa']) . "</td>";
|
||||
echo "<td>" . htmlspecialchars($row['nazwa_kat']) . "</td>";
|
||||
echo "<td>" . number_format($row['cena'], 2) . " zł</td>";
|
||||
echo "<td>" . htmlspecialchars($row['opis']) . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<tr><td colspan='4'>Błąd przy ładowaniu danych: " . $e->getMessage() . "</td></tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<h3>Adres do korespondencji</h3>
|
||||
<ul>
|
||||
<li>Adres: Katowice, ul. Mariacka 5</li>
|
||||
<li>Telefon: 32 888 88 88</li>
|
||||
</ul>
|
||||
<a href="mailto:kursy@komputerowe.pl">skontaktuj się</a>
|
||||
<a href="mailto:sklep@obuwie.pl">skontaktuj się</a>
|
||||
</main>
|
||||
<footer>
|
||||
<p>Autor strony: 99010101010</p>
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<img src="imgs/baner.png" alt="kursy komputerowe">
|
||||
<div class="header-text">hello</div>
|
||||
<img src="imgs/baner.png" alt="sklep z obuwiem">
|
||||
<div class="header-text">Sklep z obuwiem</div>
|
||||
</header>
|
||||
<nav>
|
||||
<a href="i1.html">Strona główna</a>
|
||||
<a href="i1.php">Strona główna</a>
|
||||
<a href="raty.html">Koszt rat</a>
|
||||
<a href="https://moje-szkolenia.pl/">Nasz partner</a>
|
||||
</nav>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user