adatbazis 2 update
This commit is contained in:
32
adatbazis2/edit.php
Normal file
32
adatbazis2/edit.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<!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>
|
||||
@@ -36,8 +36,8 @@ echo "<hr>";
|
||||
<?php endforeach; ?>
|
||||
<!--Műveletek létrehozás id oszlopra -->
|
||||
<div >
|
||||
<td><a class="btn btn-info" href='view.php?id=<?= $sor['id'];?> '> Megtekint </a></td>
|
||||
<td><a class="btn btn-info" href="update.php?id=<?= $sor['id'];?>"> Szerkeszt </a></td>
|
||||
<td><a class="btn btn-info" href='employees_view.php?id=<?= $sor['id'];?> '> Megtekint </a></td>
|
||||
<td><a class="btn btn-info" href="edit.php?id=<?= $sor['id'];?>"> Szerkeszt </a></td>
|
||||
<td><a class="btn btn-info" href="delete.php?id=<?= $sor['id'];?>"> Töröl </a></td>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
|
||||
$tabla = "employees";
|
||||
|
||||
print_r($_GET);
|
||||
|
||||
$alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), 'employees'); //hogyan kapom meg a tabla nevet
|
||||
$alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), $tabla);
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
@@ -15,7 +17,7 @@ $alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), 'employees'); //hogya
|
||||
<body>
|
||||
<div style="margin-left: 10%;">
|
||||
<?php
|
||||
$test = $kapcsolat->readOne($kapcsolat->getDBC(), 'employees', $_GET['id']);
|
||||
$test = $kapcsolat->readOne($kapcsolat->getDBC(), $tabla, $_GET['id']);
|
||||
//print_r($test);
|
||||
|
||||
echo "<ul>";
|
||||
@@ -35,7 +35,7 @@ echo "<hr>";
|
||||
<?php endforeach; ?>
|
||||
<!--Műveletek létrehozás id oszlopra -->
|
||||
<div >
|
||||
<td><a class="btn btn-info" href="view.php?id=<?= $sor['id']; ?>"> Megtekint </a></td>
|
||||
<td><a class="btn btn-info" href="firms_view.php?id=<?= $sor['id']; ?>"> Megtekint </a></td>
|
||||
<td><a class="btn btn-info" href="update.php?id=<?= $sor['id']; ?>"> Szerkeszt </a></td>
|
||||
<td><a class="btn btn-info" href="delete.php?id=<?= $sor['id']; ?>"> Töröl </a></td>
|
||||
</div>
|
||||
|
||||
33
adatbazis2/firms_view.php
Normal file
33
adatbazis2/firms_view.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
|
||||
$tabla = "firms";
|
||||
|
||||
print_r($_GET);
|
||||
|
||||
$alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), $tabla);
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Megtekintés</title>
|
||||
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-left: 10%;">
|
||||
<?php
|
||||
$test = $kapcsolat->readOne($kapcsolat->getDBC(), $tabla, $_GET['id']);
|
||||
//print_r($test);
|
||||
|
||||
echo "<ul>";
|
||||
foreach($test[0] as $key => $value){
|
||||
echo "<li><b>".$key.":</b> ".$value."</li><hr>";
|
||||
}
|
||||
echo "</ul>";
|
||||
?>
|
||||
<a href="employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
</div>
|
||||
<script src="kozos/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
28
adatbazis2/szerkesztes_vegrehajtas.php
Normal file
28
adatbazis2/szerkesztes_vegrehajtas.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
|
||||
$id = $_POST['id'];
|
||||
$name = $_POST['name'];
|
||||
$address = $_POST['address'];
|
||||
$salary = $_POST['salary'];
|
||||
echo $name."<br>";
|
||||
echo $address."<br>";
|
||||
echo $salary."<br>";
|
||||
|
||||
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 WHERE id=$id';
|
||||
// address=$address salary=$salary
|
||||
$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>
|
||||
</body>
|
||||
</html>
|
||||
@@ -35,7 +35,7 @@ echo "<hr>";
|
||||
<?php endforeach; ?>
|
||||
<!--Műveletek létrehozás id oszlopra -->
|
||||
<div >
|
||||
<td><a class="btn btn-info" href="view.php?id=<?= $sor['id']; ?>"> Megtekint </a></td>
|
||||
<td><a class="btn btn-info" href="workers_view.php?id=<?= $sor['id']; ?>"> Megtekint </a></td>
|
||||
<td><a class="btn btn-info" href="update.php?id=<?= $sor['id']; ?>"> Szerkeszt </a></td>
|
||||
<td><a class="btn btn-info" href="delete.php?id=<?= $sor['id']; ?>"> Töröl </a></td>
|
||||
</div>
|
||||
|
||||
33
adatbazis2/workers_view.php
Normal file
33
adatbazis2/workers_view.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
include "kozos/kapcsolat.php";
|
||||
|
||||
$tabla = "workers";
|
||||
|
||||
print_r($_GET);
|
||||
|
||||
$alkalmazottak = $kapcsolat->readAll($kapcsolat->getDBC(), $tabla);
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Megtekintés</title>
|
||||
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-left: 10%;">
|
||||
<?php
|
||||
$test = $kapcsolat->readOne($kapcsolat->getDBC(), $tabla, $_GET['id']);
|
||||
//print_r($test);
|
||||
|
||||
echo "<ul>";
|
||||
foreach($test[0] as $key => $value){
|
||||
echo "<li><b>".$key.":</b> ".$value."</li><hr>";
|
||||
}
|
||||
echo "</ul>";
|
||||
?>
|
||||
<a href="employees.php" class="btn btn-info" role="button">Vissza</a>
|
||||
</div>
|
||||
<script src="kozos/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user