0
我拥有数据库设置权限YES如果用户有权访问此权限如果用户无权访问此权限,则为否。我想根据是否勾选某个用户的复选框来更改这些答案。我希望YES答案显示为勾选复选框,而No答案显示为空白复选框。我该如何做到这一点,因为我的数据库目前正在输出YES或NO作为用户的结果。将数据库信息显示为复选框
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "databasename";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT adduser, edituser, removeuser, unlockallfiles, viewlocked, filepermissions FROM departments";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table class='table table-hover'><tr style='font-size:18px;'><th>Add User</th><th>Edit User</th><th>Remove User</th><th>Unlock All</th><th>View Locked</th><th>File Permissions</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr style='font-size:16px;'><td>".$row["adduser"]."</td><td>".$row["edituser"]."</td><td>".$row["removeuser"]."</td><td>".$row["unlockallfiles"]."</td><td>".$row["viewlocked"]. "</td><td>" .$row["filepermissions"]. "</td></tr>";
}
echo "</table>";
} else {
echo "There are 0 clients in the system matching your search criteria";
}
$conn->close();
?>
如何获取数据YES显示为打钩复选框,否则显示为空复选框?
非常完美三江源! – DGTLSS