2016-02-10 60 views
0

我需要一个帮助。我需要设置图像路径后,从数据库内使用PHP标签获取。我解释我的代码如下。如何使用PHP设置图像标签中的图像路径

$getcustomerobj = $dbobj->getNewsData($id); 
div class="input-group bmargindiv1 col-md-12"> 
<span class="input-group-addon ndrftextwidth text-left">Upload Image :</span> 
<input type="file" class="filestyle form-control" data-size="lg" name="newsimage" id="newsimage" onChange="javascript:addImage(event,'img','disImage');"> 

</div> 
<div id="disImage" style="display:none;"> 
<div class="input-group bmargindiv1 text-right col-md-12" > 
<img src="uploads/"'.<?php echo $getcustomerobj->image ?>.' name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" /> 
</div> 

我在这里从DB使用$getcustomerobj获取数据,但无法显示it.Please帮助我。

+0

插入'''$ getcustomerobj = $ dbobj-> getNewsData($ ID);'''之间并添加<到第二线,以及'''SRC = “uploads/<?php echo $ getcustomerobj-> image?>”''' – Carbos

回答

1

你做错了。该路径应位于"之内。试用 -

<img src="uploads/<?php echo $getcustomerobj->image ?>" name="pro"... 

会工作。

+0

再次检查我也没有显示最初的div。 – subhra

+0

这是实际的代码吗?如果是,那么还有更多的错误! –

+0

其不完整的代码。我已经在这里说过,我最初的图片标签不会显示。 – subhra

0

代码<img src="uploads/"'.<?php echo $getcustomerobj->image ?>.' name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />变化到

<img src="<?php echo 'uploads/'.$getcustomerobj->image ?>" name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" /> 
相关问题