php - echo image in database using path folder, -


<?php        //connect mysql , select database  mysql_connect('localhost', 'root', '') or die('could not connect: ' . mysql_error());  mysql_select_db('4dberlin') or die("can not select database");    //fetch data mysql  $result = mysql_query("select * photos ");   //iterate on each row , want.  while($row = mysql_fetch_array($result))  {       $location = $row['image'];      echo "<img src='" . $row['image'] . "' height='130' width='220'> ";  }       ?>   

the path of images in localhost/admin/uploads . dont know why not displaying images.

as per question seems $row['image'] contain name of image.

so code should like

while($row = mysql_fetch_array($result))  {       $location = $row['image'];      echo "<img src='http://localhost/admin/uploads/" . $row['image'] . "' height='130' width='220'> ";  } 

where http://localhost/admin/uploads/ path image store.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -