update
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Frissít</title>
|
||||
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="m-5">
|
||||
<form name="adatok" action="szerkesztes_vegrehajtas.php" method="POST">
|
||||
<fieldset>
|
||||
<?php
|
||||
$rekord = $kapcsolat->readOne($kapcsolat->getDBC(), 'employees', $_GET['id']);
|
||||
//print_r($rekord);
|
||||
|
||||
foreach($rekord[0] as $key => $value){
|
||||
//if($key == "id"){continue;}
|
||||
echo "<label for=\"$key\">$key</label><br>";
|
||||
echo "<input class=\"w-50\" id=\"$key\" type=\"text\" name=\"$key\" value=\"$value\"><br><br>";
|
||||
//echo $value."<br>";
|
||||
}
|
||||
?><br>
|
||||
<input type="submit" class="btn btn-info" value="Frissít">
|
||||
<a href="employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script src="kozos/bootstrap.min.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
41
adatbazis2/employees/edit.php
Normal file
41
adatbazis2/employees/edit.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
include "../kozos/kapcsolat.php";
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Frissít</title>
|
||||
<link href="../kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<style>
|
||||
p{
|
||||
border: 1px solid black;
|
||||
padding-left: 0.5%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="m-5">
|
||||
<form name="adatok" action="../szerkesztes_vegrehajtas.php" method="POST">
|
||||
<fieldset>
|
||||
<?php
|
||||
$rekord = $kapcsolat->readOne($kapcsolat->getDBC(), 'employees', $_GET['id']);
|
||||
//print_r($rekord);
|
||||
|
||||
foreach($rekord[0] as $key => $value){
|
||||
//if($key == "id"){continue;}
|
||||
echo "<label for=\"$key\">$key</label><br>";
|
||||
if($key == "id"){
|
||||
echo "<p class=\"w-50\" id=\"$key\" type=\"text\" name=\"$key\" value=\"$value\">$value</p>";
|
||||
}else{
|
||||
echo "<input class=\"w-50\" id=\"$key\" type=\"text\" name=\"$key\" value=\"$value\"><br><br>";
|
||||
}
|
||||
//echo $value."<br>";
|
||||
}
|
||||
?><br>
|
||||
<input type="submit" class="btn btn-info" value="Frissít">
|
||||
<a href="employees/employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script src="../kozos/bootstrap.min.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
include "../kozos/kapcsolat.php";
|
||||
|
||||
$t_employees = 'employees';
|
||||
//$t_employees = 'employees';
|
||||
$employees = $kapcsolat->readAll($kapcsolat->getDBC(), "employees");
|
||||
|
||||
print_r($employees);
|
||||
@@ -12,7 +12,7 @@ echo "<hr>";
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Employees</title>
|
||||
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid w-75">
|
||||
@@ -45,6 +45,6 @@ echo "<hr>";
|
||||
</table>
|
||||
<a class="btn btn-info" href="index.php">Vissza</a>
|
||||
</div>
|
||||
<script src="kozos/bootstrap.min.js" type="text/javascript"></script>
|
||||
<script src="../kozos/bootstrap.min.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
include "../kozos/kapcsolat.php";
|
||||
|
||||
$tabla = "employees";
|
||||
|
||||
@@ -12,7 +12,7 @@ $alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), $tabla);
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Megtekintés</title>
|
||||
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-left: 10%;">
|
||||
@@ -28,6 +28,6 @@ $alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), $tabla);
|
||||
?>
|
||||
<a href="employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
</div>
|
||||
<script src="kozos/bootstrap.min.js"></script>
|
||||
<script src="../kozos/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,7 +2,6 @@
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
|
||||
|
||||
$adatok = [];
|
||||
if (isset($_POST['insert'])) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
@@ -10,16 +9,14 @@ if (isset($_POST['insert'])) {
|
||||
$adatok[$key] = $value;
|
||||
}
|
||||
}
|
||||
$kapcsolat->insert($kapcsolat->getDBC(), 'pizzak', $adatok);
|
||||
$kapcsolat->insert($kapcsolat->getDBC(), '', $adatok); //tábla nevet hozzaadni
|
||||
header('Location: index.php');
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Pizzák</title>
|
||||
<title>Hozzáadás</title>
|
||||
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
|
||||
</head>
|
||||
@@ -31,23 +28,16 @@ if (isset($_POST['insert'])) {
|
||||
<input type="text" class="form-control" id="nev" name="nev" placeholder="">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="feltetek" class="form-label">Feltétek</label>
|
||||
<input type="text" class="form-control" id="feltetek" name="feltetek" placeholder="">
|
||||
<label for="cim" class="form-label">Cím</label>
|
||||
<input type="text" class="form-control" id="cim" name="cim" placeholder="">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ar" class="form-label">Ár</label>
|
||||
<input type="number" class="form-control" id="ar" name="ar" placeholder="">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="kep" class="form-label">Kép(Csak a fájl nevét add meg! pl.: napoli.jpg) </label>
|
||||
<input type="text" class="form-control" id="kep" name="kep" placeholder="">
|
||||
<label for="fizetes" class="form-label">Fizetés</label>
|
||||
<input type="number" class="form-control" id="fizetes" name="fizetes" placeholder="">
|
||||
</div>
|
||||
<input class="btn btn-info" type="submit" name="insert" value="Beszúrás" />
|
||||
<a class="btn btn-info" href="index.php">Vissza</a>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<script src="kozos/bootstrap.min.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
||||
@@ -15,13 +15,17 @@
|
||||
try{
|
||||
//$kapcsolat->deleteOne($kapcsolat->getDBC(), 'employees', $id); //rekord torlese az uj adatok atadasa elott
|
||||
//$uj = "UPDATE `employees` (`id`, `name`, `address`, `salary`) VALUES ('$id','$nev','$address','$salary')"; //sql parancs
|
||||
$sql = "UPDATE `employees` SET name='$name' and address='$address' and salary='$salary' WHERE id='$id'";
|
||||
$sql = "UPDATE `employees` SET name='$name' WHERE id='$id'";
|
||||
$kapcsolat->getDBC()->exec($sql);
|
||||
$sql = "UPDATE `employees` SET address='$address' WHERE id='$id'";
|
||||
$kapcsolat->getDBC()->exec($sql);
|
||||
$sql = "UPDATE `employees` SET salary='$salary' WHERE id='$id'";
|
||||
$kapcsolat->getDBC()->exec($sql);
|
||||
echo "Az új rekord létrehozása sikeres!";
|
||||
}catch(PDOException $e){
|
||||
echo $sql."<br>".$e->getMessage();
|
||||
}
|
||||
?>
|
||||
<br><br><a href="employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
<br><br><a href="employees/employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user