我有一个问题,试图检索存储在MYSQL数据库中的用户配置文件链接。
我尝试运行此代码来选择用户配置文件(存储用户配置文件图片链接的位置),但出现了500错误。
<?php
$stmt = $DB_con->prepare('SELECT id, userprofile FROM users ');
$stmt->execute();
if($stmt->rowCount() > 0)
{
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
extract($row);
?>

链接存储在userprofile列中。
超文本标记语言(function.php包含数据库信息):
<?php
include('functions.php');
if (!isAdmin()) {
$_SESSION['msg'] = "You must log in first";
header('location: ../login.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title> Admin Home</title>
</head>
<body>
<div class="header">
<h2>Admin - Home Page</h2>
</div>
<div class="content">
<!-- notification message -->
<!-- logged in user information -->
<div class="profile_info">
<img src="uploads/<?php echo $row['userprofile']; ?>" class="img-rounded" width="250px" height="250px" />
<div>
<?php if (isset($_SESSION['user'])) : ?>
<strong><?php echo $_SESSION['user']['username']; ?></strong>
<small>
<i style="color: #888;">(<?php echo ucfirst($_SESSION['user']['user_type']); ?>)</i>
<br>
<a href="home.php?logout='1'" style="color: red;">logout</a>
<a href="create_user.php"> + add user</a>
</small>
<?php endif ?>
</div>
</div>
</div>
</body>
</html>登录的测试用户的图像(Bigfella)

你知道为什么它不能从数据库中检索图像链接吗?提前感谢!!
https://stackoverflow.com/questions/47784899
复制相似问题