我知道这个问题已经被问过很多次了,但我无法使用其中任何一个来解决这个问题。
我是 sqlite 的新手,无法理解我做错了什么。
我正在尝试什么
我正在尝试制作个人资料查看页面。我可以从我的 sqlite 数据库中获取所有详细信息,但无法显示我的个人资料图片。
表结构
**username|landline|mobile|email|profilepicture**
john |xxxxxxxx|xxxxxx|[email protected]|blob
我尝试过的
$sql = "SELECT * FROM profile";
$query = $db->query($sql);
while($row = $query->fetchArray(SQLITE3_ASSOC) ){
echo "NAME = ". $row['user_name'] . "<br/>";
echo "LANDLINE = ". $row['user_landline'] ."<br/>";
echo "MOBILE = ". $row['user_mobile'] ."<br/>";
echo "EMAIL = ".$row['user_email'] ."<br/>";
header('Content-Type: image/png');
echo $row['user_profile_picture'];
}
<html>
<img src='profile.php?imgid=<?php echo $row['user_profile_picture'];?>'/>
</html>
但图像没有显示,当我输入时,其余数据也没有显示header('Content-Type: image/png');
创建一个image.php:
<?php
$sql = "SELECT user_profile_picture FROM profile WHERE id = " . $_GET['id'];
$query = $db->query($sql);
$row = $query->fetchArray(SQLITE3_ASSOC);
header('Content-Type: image/png');
echo $row['user_profile_picture'];
在 profile.php 中:
<img src='image.php?id=<?php echo $row['id'];?>'/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)