问题遇到的现象和发生背景
用PHP写了一个查询中药的功能,但是显示图片那一部分不知道应该怎样处理。
现在是在MySQL中插入的图片路径,然后在查询结果中也直接显示了路径(呆)
//没排格式 请忽略
用代码块功能插入代码,请勿粘贴截图
显示结果页面的代码
<!DOCTYPE html>
<html>
<head>
<title>查询结果</title>
<meta charset="UTF-8">
</head>
<body>
<div id="kuangjia" style="width:1200px">
<div id="header" style="background-color:#99d6ea80;text-align:center">查询结果</div>
<?php
$conn = mysqli_connect("localhost", "root", "123456") or die("数据库链接错误");
$db_selected=mysqli_select_db($conn,"SafeAskM");
$searchctm = isset($_POST['searchctm']) ? $_POST['searchctm']:'';
if(!empty($searchctm)) {
$sql = "SELECT cmname,anotname,plant,shape,taste,attribute,attention,picture FROM ask_cm WHERE cmname LIKE '%$searchctm%' or anotname LIKE '%$searchctm'";
$query = mysqli_query($conn,$sql);
while($row = mysqli_fetch_row($query)) {
$valuea = '';
foreach($row as $valuea){
echo $valuea;
}
}
}else{
echo"啊哦,页面不见了哦";
}
?>
<div id="footer" style="background-color:#99d6ea80;clear:both;text-align:center">⚠本站结果仅供参考,若有不适请您及时就医⚠</div>
</div>
</body>
</html>
数据库结构:
想要让它正常的显示图片!谢谢了!