update
This commit is contained in:
BIN
kepregeny/5_Képregény.pdf
Normal file
BIN
kepregeny/5_Képregény.pdf
Normal file
Binary file not shown.
BIN
kepregeny/SRC_képregény/hatter.jpg
Normal file
BIN
kepregeny/SRC_képregény/hatter.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
117
kepregeny/index.php
Normal file
117
kepregeny/index.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
include_once "kapcsolat.php";
|
||||
|
||||
$tabla = $kapcsolat->readAll($kapcsolat->getDBC(), "comics");
|
||||
//print_r($tabla);
|
||||
|
||||
$keys = ["id", "Kiadó", "Cím", "Sorozat", "Író", "Rajzoló", "Műfaj", "Szereplők"];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title>Képregény</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<h1 class="cim">Képregényeim</h1><br>
|
||||
<div class="flexbox-container">
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Kiadó:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="text" name="kiado" id="kiado">
|
||||
<button>Rögzít</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Cím:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="text" name="cim" id="cim">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Sorozat:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="number" name="sorozat" id="sorozat">
|
||||
Keress rá egy szereplőre
|
||||
</div>
|
||||
</div>
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Író:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="text" name="iro" id="iro">
|
||||
<input type="text" name="keres" id="keres">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Rajzoló:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="text" name="rajzolo" id="rajzolo">
|
||||
<button>Keresés</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Műfaj:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="text" name="mufaj" id="mufaj">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sor">
|
||||
<div class="title">
|
||||
Szereplők:
|
||||
</div>
|
||||
<div class="bevitel">
|
||||
<input type="text" name="szereplok" id="szereplok">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="tabla">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Kiadó</th>
|
||||
<th>Cím</th>
|
||||
<th>Sorozat</th>
|
||||
<th>Író</th>
|
||||
<th>Rajzoló</th>
|
||||
<th>Műfaj</th>
|
||||
<th>Szereplők</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($tabla as $key => $value) {
|
||||
echo "<tr>";
|
||||
foreach ($keys as $key2 => $value2) {
|
||||
if($value2 == "id"){
|
||||
continue;
|
||||
}
|
||||
echo "<td>".$value[$value2]."</td>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<div align="right">
|
||||
<button>Lekérdezés</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="script.js"></script>
|
||||
</html>
|
||||
95
kepregeny/kapcsolat.php
Normal file
95
kepregeny/kapcsolat.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
class Kapcsolat{
|
||||
//adattagok
|
||||
private $host = 'localhost';
|
||||
private $dbuser = 'root';
|
||||
private $password = '';
|
||||
private $dbname = 'kepregeny';
|
||||
private $dbc;
|
||||
//konstruktor
|
||||
public function __construct(){
|
||||
try {
|
||||
$datasourcename = "mysql:host=$this->host;dbname=$this->dbname";
|
||||
//echo $datasourcename . "<hr>";
|
||||
$options = [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
|
||||
$this->dbc = new PDO($datasourcename, $this->dbuser, $this->password, $options);
|
||||
} catch (PDOException $exc) {
|
||||
echo "Kapcsolódási hiba:" . $exc->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
//metodusok
|
||||
public function getDBC(){
|
||||
return $this->dbc;
|
||||
}
|
||||
|
||||
//tabla beolvasasa
|
||||
public function readAll($dbc, $table) {
|
||||
$sql = "SELECT * FROM $table;";
|
||||
$utasitas = $dbc->prepare($sql);
|
||||
$utasitas->execute();
|
||||
|
||||
return $utasitas->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
//egy rekord beolvasasa
|
||||
public function readOne($dbc, $table, $id) {
|
||||
$sql = "SELECT * FROM $table WHERE id=$id;";
|
||||
$utasitas = $dbc->prepare($sql);
|
||||
$utasitas->execute();
|
||||
|
||||
return $utasitas->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
//egy rekord torlese
|
||||
public function deleteOne($dbc, $table, $id) {
|
||||
$sql = "DELETE FROM $table WHERE id=$id;";
|
||||
$utasitas = $dbc->prepare($sql);
|
||||
$utasitas->execute();
|
||||
}
|
||||
|
||||
// Mivel az id automatikusan generalodik ezért a id értéke helyett NULL értéket adunk meg beillesztéskor
|
||||
//uj rekord beszurasa
|
||||
public function insert($dbc, $table, $datas) {
|
||||
$sql = "INSERT INTO $table VALUES (NULL, '";
|
||||
foreach ($datas as $value) {
|
||||
$sql .= $value . "', '";
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 3);
|
||||
$sql .= ");";
|
||||
$utasitas = $dbc->prepare($sql);
|
||||
$utasitas->execute();
|
||||
}
|
||||
|
||||
//rekord adatinak szerkesztese
|
||||
public function update($dbc, $table, $datas) {
|
||||
$sql = "UPDATE $table SET ";
|
||||
//print_r($datas);
|
||||
foreach ($datas as $key => $value) {
|
||||
if ($key <> 'id') {
|
||||
$sql .= $key . "='" . $value . "', ";
|
||||
}
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2);
|
||||
$sql .= " WHERE id =" . $datas['id'] . ";";
|
||||
//print_r($sql);
|
||||
$utasitas = $dbc->prepare($sql);
|
||||
$utasitas->execute();
|
||||
}
|
||||
|
||||
public function lekerdezes($tabla, $keys){
|
||||
foreach ($tabla as $key => $value) {
|
||||
echo "<tr>";
|
||||
foreach ($keys as $key2 => $value2) {
|
||||
if($value2 == "id"){
|
||||
continue;
|
||||
}
|
||||
echo "<td>".$value[$value2]."</td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$kapcsolat = new Kapcsolat();
|
||||
?>
|
||||
0
kepregeny/script.js
Normal file
0
kepregeny/script.js
Normal file
65
kepregeny/style.css
Normal file
65
kepregeny/style.css
Normal file
@@ -0,0 +1,65 @@
|
||||
*{
|
||||
font-family: Tahoma;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
body{
|
||||
background-image: url('\SRC_képregény\\hatter.jpg');
|
||||
margin: 2%;
|
||||
}
|
||||
|
||||
input{
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
table{
|
||||
background-color: lightblue;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
th{
|
||||
padding-left: 0.5%;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-left: 0.5%;
|
||||
}
|
||||
|
||||
table, th, td{
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
button{
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.cim{
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
font-family: Tahoma;
|
||||
margin-left: 19%;
|
||||
}
|
||||
|
||||
.title{
|
||||
float:left;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.bevitel{
|
||||
margin-left: 10%;
|
||||
}
|
||||
|
||||
.bevitel input{
|
||||
margin-right: 3%;
|
||||
}
|
||||
|
||||
.sor{
|
||||
margin-bottom: 1.5%;
|
||||
}
|
||||
|
||||
.tabla{
|
||||
/*float: left;*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user