Reputation:
I need one help.I need to set the image path after fetched from DB inside image tag using PHP.I am explaining my code below.
$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>
Here i am getting the data from DB using $getcustomerobj
but unable to display it.Please help me.
Upvotes: 0
Views: 7962
Reputation: 1483
your code <img src="uploads/"'.<?php echo $getcustomerobj->image ?>.' name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
change to
<img src="<?php echo 'uploads/'.$getcustomerobj->image ?>" name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
Upvotes: 0
Reputation: 31739
You are doing it wrong. The path should be inside the "
s. Try with -
<img src="uploads/<?php echo $getcustomerobj->image ?>" name="pro"...
would work.
Upvotes: 1