第11行是while ($row = mysqli_fetch_array($select_user_profile_query)) {
警告:mysqli_fetch_array()要求参数1为mysqli_result,第11行的C:\ xampp \ htdocs \ renda \ admin \ profile.php中给出布尔值
if(isset($_SESSION['username'])) {
$username = $_SESSION['username'];
$query = "SELECT * users WHERE username ='{$username}' ";
$select_user_profile_query = mysqli_query($connection, $query);
while ($row = mysqli_fetch_array($select_user_profile_query)) {
$user_id = $row['user_id'];
$username = $row['username'];
$user_password = $row['user_password'];
$user_firstname = $row['user_firstname'];
$user_lastname = $row['user_lastname'];
$user_email = $row['user_email'];
$user_image = $row['user_image'];
$user_role = $row['user_role'];
}
}
谢谢!
答案 0 :(得分:-1)
sql语句缺少from
,也许您应该在尝试迭代记录集之前测试查询是否成功
<?php
if(isset($_SESSION['username'])) {
$username = $_SESSION['username'];
$query = "SELECT * from `users` WHERE `username` ='{$username}' ";
$select_user_profile_query = mysqli_query( $connection, $query );
if($select_user_profile_query) {
while ($row = mysqli_fetch_array($select_user_profile_query)) {
$user_id = $row['user_id'];
$username = $row['username'];
$user_password = $row['user_password'];
$user_firstname = $row['user_firstname'];
$user_lastname = $row['user_lastname'];
$user_email = $row['user_email'];
$user_image = $row['user_image'];
$user_role = $row['user_role'];
}
}
}
?>