日期:2014-05-17  浏览次数:20516 次

如何将已经上传的图显示到前台
我的图片保存路径已经有了
数据库中叫PicUrl

/test/uploads/1340957340.jpg

那我在前台怎么显示?
我现在是这样的 
$sql = "select ProName,text,ProID,PicUrl from products where ProID=$id";
$query = mysql_query($sql);

<?php echo '<image src="localhost:8080.'$query[PicUrl]'.">' ?> 我也觉得有错误,但是怎么改啊,高手指教

------解决方案--------------------
$query = mysql_query($sql);
$row=mysql_fetch_assoc($query);
<?php echo '<image src="localhost:8080'.$row[PicUrl].'">' ?>

------解决方案--------------------
<?php echo "<image src='localhost:8080$row[PicUrl]'>" ?>
------解决方案--------------------
print_r($row); 数据库有不有数据哟?
------解决方案--------------------
<?php echo "<image src='localhost:8080".$row['PicUrl']."'>" ?>
#在html中可直接:
<img src='localhost:8080<?=$row['PicUrl']?>' />
另,确定你的路径是正确的,查看页面源码
------解决方案--------------------
 
<img src='http://localhost:8080<?=$row['PicUrl']?>' />