所以我试图创建一个下拉菜单,其中包含数据库中所有经过验证的用户而不是管理员(它们都是数据库中的列),并从“所有者”列中获取用户名,并将每个用户放在下拉菜单中。我收到错误警告:mysqli_result::fetch_assoc() 需要 0 个参数,1 在第 47 行的 /home/content/96/10688096/html/testserver/requestpage.php 中给出
session_start();
if($_SESSION['admin']=='y') {
?>
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="Scripts/request.js"></script>
<link rel='stylesheet' href='CSS/requestpage.css'>
<title> Admin Page </title>
</head>
<body>
<!-- Header Divs -->
<div id='header'>
<div id='title'>
<!-- Header Text -->
</div>
</div>
<div id='sidebar'>
<?php
$username = $_SESSION['id'];
$usernamelc = strtolower($username);
$userimage = "<img src='images/$usernamelc.png'> ";
$adminid = $_SESSION['recid'];
include('connection.php');
$sidebar = "<div id='sidebar'> <table id='admininfo'> <tr> <td colspan='2'> $userimage</td> </tr>
<tr> <td colspan='2'> <span> Welcome, $username </span> </td> </tr> <tr> <td> Admin: </td> <td> $username </td> </tr>
<tr> <td> ID: </td> <td> $adminid </td> </tr> <tr> <td> Number of Users: </td> <td> {$users} </td> </tr> <tr> <td colspan='2'> <span> Emulator </span> </td> </tr>
<select>";
$users = $db->query("SELECT Owner FROM users WHERE verified = 'y' AND admin ='n'");
while ($row = $users->fetch_array($users)) {
$sidebar .= "<option value='{$row['Owner']}'> </option>";
}
$sidebar .= "</select> </td> </tr> </table> </div>";
echo $sidebar;
?>
</div>
<?php
}
?>