diff --git a/Lekcja_02/config.php b/Lekcja_02/config.php new file mode 100644 index 0000000..57fca48 --- /dev/null +++ b/Lekcja_02/config.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/Lekcja_02/dbexport/lekcja2.sql b/Lekcja_02/dbexport/lekcja2.sql new file mode 100644 index 0000000..007c00e --- /dev/null +++ b/Lekcja_02/dbexport/lekcja2.sql @@ -0,0 +1,161 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: Wrz 21, 2026 at 10:41 AM +-- Wersja serwera: 12.0.2-MariaDB-log +-- Wersja PHP: 8.3.25 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `lekcja2` +-- + +-- -------------------------------------------------------- + +-- +-- Struktura tabeli dla tabeli `flagi` +-- + +CREATE TABLE `flagi` ( + `id` int(11) NOT NULL, + `kraj` varchar(255) NOT NULL, + `plik` varchar(255) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `flagi` +-- + +INSERT INTO `flagi` (`id`, `kraj`, `plik`) VALUES +(1, 'Albania', 'Albania.jpg'), +(2, 'Algieria', 'Algieria.jpg'), +(3, 'Australia', 'Australia.jpg'), +(4, 'Barbados', 'Barbados.jpg'), +(5, 'Belgia', 'Belgia.jpg'), +(6, 'Belize', 'Belize.jpg'), +(7, 'Bermudy', 'Bermudy.jpg'), +(8, 'Bhutan', 'Bhutan.jpg'), +(9, 'Boliwia', 'Boliwia.jpg'); + +-- -------------------------------------------------------- + +-- +-- Struktura tabeli dla tabeli `main` +-- + +CREATE TABLE `main` ( + `id` int(11) NOT NULL, + `flaga` int(11) NOT NULL, + `nominal` varchar(255) NOT NULL, + `nr_kat` varchar(255) NOT NULL, + `stop` int(11) NOT NULL, + `rok` varchar(255) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `main` +-- + +INSERT INTO `main` (`id`, `flaga`, `nominal`, `nr_kat`, `stop`, `rok`) VALUES +(1, 1, 'peso', '1234', 6, '2010'); + +-- -------------------------------------------------------- + +-- +-- Struktura tabeli dla tabeli `stopy` +-- + +CREATE TABLE `stopy` ( + `id` int(11) NOT NULL, + `nazwa` varchar(255) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `stopy` +-- + +INSERT INTO `stopy` (`id`, `nazwa`) VALUES +(1, 'aluminum'), +(2, 'aluminum-bronze'), +(3, 'bronze'), +(4, 'copper plated zinc'), +(5, 'copper-nickel'), +(6, 'gold'), +(7, 'nickel bonded steel'), +(8, 'nickel clad steel'), +(9, 'silver'), +(10, 'stainless steel'), +(11, 'zinc'); + +-- +-- Indeksy dla zrzutów tabel +-- + +-- +-- Indeksy dla tabeli `flagi` +-- +ALTER TABLE `flagi` + ADD PRIMARY KEY (`id`); + +-- +-- Indeksy dla tabeli `main` +-- +ALTER TABLE `main` + ADD PRIMARY KEY (`id`), + ADD KEY `flaga` (`flaga`), + ADD KEY `stop` (`stop`); + +-- +-- Indeksy dla tabeli `stopy` +-- +ALTER TABLE `stopy` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `flagi` +-- +ALTER TABLE `flagi` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; + +-- +-- AUTO_INCREMENT for table `main` +-- +ALTER TABLE `main` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `stopy` +-- +ALTER TABLE `stopy` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `main` +-- +ALTER TABLE `main` + ADD CONSTRAINT `main_ibfk_1` FOREIGN KEY (`flaga`) REFERENCES `flagi` (`id`), + ADD CONSTRAINT `main_ibfk_2` FOREIGN KEY (`stop`) REFERENCES `stopy` (`id`); +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/Lekcja_02/delete.php b/Lekcja_02/delete.php new file mode 100644 index 0000000..2406f31 --- /dev/null +++ b/Lekcja_02/delete.php @@ -0,0 +1,15 @@ +prepare("DELETE FROM main WHERE id=?"); + + $stmt->bind_param("i", intval($_GET["id"])); + $stmt->execute(); + mysqli_close($conn); + + + header("Location: ./"); + exit(); +?> \ No newline at end of file diff --git a/Lekcja_02/gfx/Albania.jpg b/Lekcja_02/gfx/Albania.jpg new file mode 100755 index 0000000..5919e28 Binary files /dev/null and b/Lekcja_02/gfx/Albania.jpg differ diff --git a/Lekcja_02/gfx/Algieria.jpg b/Lekcja_02/gfx/Algieria.jpg new file mode 100755 index 0000000..f485382 Binary files /dev/null and b/Lekcja_02/gfx/Algieria.jpg differ diff --git a/Lekcja_02/gfx/Australia.jpg b/Lekcja_02/gfx/Australia.jpg new file mode 100755 index 0000000..5ea7d23 Binary files /dev/null and b/Lekcja_02/gfx/Australia.jpg differ diff --git a/Lekcja_02/gfx/Barbados.jpg b/Lekcja_02/gfx/Barbados.jpg new file mode 100755 index 0000000..2536289 Binary files /dev/null and b/Lekcja_02/gfx/Barbados.jpg differ diff --git a/Lekcja_02/gfx/Belgia.jpg b/Lekcja_02/gfx/Belgia.jpg new file mode 100755 index 0000000..6b08775 Binary files /dev/null and b/Lekcja_02/gfx/Belgia.jpg differ diff --git a/Lekcja_02/gfx/Belize.jpg b/Lekcja_02/gfx/Belize.jpg new file mode 100755 index 0000000..bd896d5 Binary files /dev/null and b/Lekcja_02/gfx/Belize.jpg differ diff --git a/Lekcja_02/gfx/Bermudy.jpg b/Lekcja_02/gfx/Bermudy.jpg new file mode 100755 index 0000000..a4dc0a9 Binary files /dev/null and b/Lekcja_02/gfx/Bermudy.jpg differ diff --git a/Lekcja_02/gfx/Bhutan.jpg b/Lekcja_02/gfx/Bhutan.jpg new file mode 100755 index 0000000..e36edfb Binary files /dev/null and b/Lekcja_02/gfx/Bhutan.jpg differ diff --git a/Lekcja_02/gfx/Boliwia.jpg b/Lekcja_02/gfx/Boliwia.jpg new file mode 100755 index 0000000..b11d07e Binary files /dev/null and b/Lekcja_02/gfx/Boliwia.jpg differ diff --git a/Lekcja_02/gfx/faja.png b/Lekcja_02/gfx/faja.png new file mode 100755 index 0000000..4d1fdd7 Binary files /dev/null and b/Lekcja_02/gfx/faja.png differ diff --git a/Lekcja_02/gfx/u.gif b/Lekcja_02/gfx/u.gif new file mode 100755 index 0000000..39fbd91 Binary files /dev/null and b/Lekcja_02/gfx/u.gif differ diff --git a/Lekcja_02/index.php b/Lekcja_02/index.php new file mode 100644 index 0000000..05f0324 --- /dev/null +++ b/Lekcja_02/index.php @@ -0,0 +1,112 @@ + + + + + + Lekcja 2 + + + +
+    
+    
+
+ + + + + + + + + + "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + ?> + + + + + + + + + + + + + +
nominałnr kat.stoprok
" . $row["kraj"] . "" . $row["nominal"] . "" . $row["nr_kat"] . "" . $row["stop"] . "" . $row["rok"] . "Usuń
Dodawanie rekordu
+ + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/Lekcja_02/insert.php b/Lekcja_02/insert.php new file mode 100644 index 0000000..de9bcfc --- /dev/null +++ b/Lekcja_02/insert.php @@ -0,0 +1,13 @@ +
+prepare("INSERT INTO main(flaga, nominal, nr_kat, `stop`, rok) VALUES(?, ?, ?, ?, ?)");
+
+    // $stmt->bind_param("issis", $_POST[""])
+
+    mysqli_close($conn);
+?>
+
\ No newline at end of file