Backend/SQL_20250122/index.php

40 lines
1015 B
PHP
Raw Normal View History

2025-01-22 08:17:28 +00:00
<?php
require_once('config.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php if(!isset($_POST["user"])) {
?>
<form action="" method="POST">
<label>felhasználó neve: </label>
<input type="text" name="user">
<button type="submit">Felhasználó adatainak megjelenítése</button>
</form>
<?php } else {
$sql = "SHOW GRANTS FOR ".$_POST["user"].";";
$result = $conn->query($sql);
if ($result) {
// Bejárjuk az eredményhalmazt
while ($row = $result->fetch_array(MYSQLI_NUM)) {
foreach ($row as $grant) {
echo $grant . "<br>";
}
}
} else {
echo "Hiba a lekérdezésben: " . $conn->error;
}
}
?>
</body>
</html>