php - 从 MySQL 数据库 PHP 回显图像

标签 php mysql image echo

我一直在尝试使用 PHP 从我的数据库中回显图像。我尝试了论坛上的各种解决方案,但没有成功。我只是得到一个空白图像作为输出。

while($rows=mysqli_fetch_assoc($getquery))
{
    $id=$rows['id'];
    $LastName=$rows['LastName'];
    $FirstName=$rows['FirstName'];
    $Year=$rows['Year'];
    $Press=$rows['Press'];
    $Description=$rows['Description'];
    $Title=$rows['Title'];
    $image=$rows['image'];


    echo '<div class = "paragraph">' . $LastName . '<br/>'. $FirstName . '<br/>' . $Year . '<br/>' .  $Press . '<br/>' . $Title . '<br/>'. $Description . "<img src='image/".$row['image']."' />" . '</div>' ;
}

最佳答案

您将图像回显为 $row['image'],但之前对该图像的唯一引用是 $rows['image'] (注意s) 和 $image。更新 echo 语句以使用其中任何一个,而不是 $row['image']

编辑:这不会完全解决您的问题。正如对您问题的评论中所述,您需要做一些欺骗才能实际显示图像,如here所示。 .

关于php - 从 MySQL 数据库 PHP 回显图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38903322/

相关文章:

php - 创建用户时 Laravel Tinker 错误 - 在 eval()'d 中找不到 'User'

javascript - JS/CSS : Preload images from the HTML file while they are hidden

jquery - 检查 jquery(js) 中的字段是否为空?

php - 如何在 MySQL 中搜索包含两个或多个由空格分隔的单词的字符串字段?

mysql - #在MS Access前端删除到MYSQL数据库

php - 如果特定型号不在\App 中,则无法找到该型号

css - 在 HTML 中更改背景图像的不透明度

php - 如何解决phpmyadmin中的超时问题?

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

php - 如何正确使用mysqli进行查询和防止注入(inject)