2016-02-10 57 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;" /> 
相關問題