Php 未显示来自数据库的图片
我试图显示存储在数据库中的图片,但当我运行代码时,出现了图片文本的早午餐。(如下图所示) 下面是显示数据库内容的代码Php 未显示来自数据库的图片,php,html,mysql,Php,Html,Mysql,我试图显示存储在数据库中的图片,但当我运行代码时,出现了图片文本的早午餐。(如下图所示) 下面是显示数据库内容的代码 <?php include ("connectdb.php"); try { $rows = $db -> query("SELECT animal_id, title, animal_dob, animal_type, animal_description,picture_of_animal FROM animals")
<?php
include ("connectdb.php");
try {
$rows = $db -> query("SELECT animal_id, title, animal_dob, animal_type, animal_description,picture_of_animal FROM animals");
?> <table>
<tr>
<th> Animal id <th> Title </th> <th> Date of birth </th> <th> Type </th><th>Description</th><th>Picture</th>
</tr> <?php
foreach ($rows as $rows => $r) {
?>
<tr>
<td><?php echo $r['animal_id']; ?></td>
<td><?php echo $r['title']; ?> </td>
<td><?php echo $r['animal_dob']; ?> </td>
<td><?php echo $r['animal_description']; ?> </td>
<td><img src "<?php echo $r['picture_of_animal']; ?>" </td>
</tr>
<?php
}
?>
</table>;
<?php
}catch (PDOException $ex) {
?>
<p>Sorry, a database error occurred.</p>
<p> Error details: <em> <?= $ex->getMessage() ?> </em></p>
<?php
}
?>
动物id标题出生日期类型描述图片
"
;
很抱歉,发生数据库错误
错误详细信息:
这是我的数据表的图片
您错过了等号,所以添加它和alao图像关闭标记
<td><img src= "<?php echo $r['picture_of_animal']; ?>"/> </td>
“/>
您不能只回显原始BLOB,您必须提供一个只为一个图像服务的专用URL(具有正确的标题),或者将其删除。