因此,我无法理解如何单独修改 SQL 条目,同时将所有结果打印到屏幕上。我让 root_user.php 将除 root_user 之外的所有用户打印到屏幕上,并且在每个要求批准或拒绝的用户旁边都有 href。在我看来,我需要approve.php 和deny.php 才能编写SQL 查询,但我不知道如何从列表中获取单个条目,然后在approve 或deny.php 中修改它文件。现在我只有 Approve 和 Deny 链接,它们会将您发送到一个空的approve 或deny.php。有人知道我可以去哪里吗?
到目前为止我的代码:
<?php
require('database.php');
$query = 'SELECT *
FROM credentials
WHERE access_level != 0
ORDER BY email';
$statement = $db->prepare($query);
$statement->execute();
$credentials = $statement->fetchAll();
$statement->closeCursor();
?>
<!DOCTYPE html>
<html>
<!-- the head section -->
<head>
<title>root</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<!-- the body section -->
<body>
<main>
<section>
<table>
<tr>
<th>Email</th>
<th>Access Level</th>
<th class="right">Actions</th>
</tr>
<?php foreach ($credentials as $credential) : ?>
<tr>
<td><?php echo $credential['email']; ?></td>
<td><?php if($credential['access_level'] == 1)
{
echo "Admin";
}
else
{
echo "Scheduler";
}
?></td>
<td class="right"><a href="approve.php" class="button-class">Approve</a>
<td class="right"><a href="deny.php" class="button-class">Deny</a></td>
</tr>
<?php endforeach; ?>
</table>
</section>
</main>
<footer></footer>
</body>
</html>
守着一只汪
相关分类