Notice: Undefined variable: id in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Notice: Undefined variable: username in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Notice: Undefined variable: email in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Notice: Undefined variable: password in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Notice: Undefined variable: ban in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Вот ошибки:
Notice: Undefined variable: role in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Warning: mysqli_connect(): (HY000/1045): Access denied for user ''@'localhost' (using password: NO) in D:\OSPanel\domains\localhost\3\reg\user.php on line 5
Fatal error: Uncaught Error: Call to undefined function myswli_query() in D:\OSPanel\domains\localhost\3\reg\user.php:6 Stack trace: #0 {main} thrown in D:\OSPanel\domains\localhost\3\reg\user.php on line 6
Вот код:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
$link = mysqli_connect($id, $username, $email, $password, $ban, $role);
myswli_query($link, "SET NAMES 'utf8'");
if (isset($_GET['del'])){
$id = $_GET['del'];
$query = "DELETE FROM user WHERE id=$id";
mysqli_query($link, $query) or die (mysqli_error($link));
}
$query = "SELECT * FROM user";
$result = mysqli_query($link, $query) or die (mysqli_error($link));
for ($data = []; $row = mysqli_fetch_assoc($result); $data[] = $row);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<title>Авторизация</title>
</head>
<body>
<table>
<?php foreach ($data as $user) { ?>
<tr>
<td><?= $user['id'] ?></td>
<td><?= $user['username'] ?></td>
<td><a href="?del=<?= $user['id'] ?>">delete</a></td>
</tr>
<?php }?>
</table>
}
</body>
</html>