php - mysqli not displaying image from database -



php - mysqli not displaying image from database -

im changing mysqli , because im learning pretty hard. doing wrong? images appear broken , prints file name, know simple question ive tried searching net no result. sorry im learning

<?php include_once("db_conex.php"); $query = "select * employees order cost asc"; $query = mysqli_real_escape_string($db,$query); if($result = mysqli_query($db,$query)){ while($row = mysqli_fetch_object($result)){ echo "<br /><br />"; echo '<img src="/upload/ " border=0>', $row->photo; echo "<br /><br />"; echo '<b> city: </b>', $row->city; echo '<b> price: </b>', $row->price; echo '<b> bath: </b>', $row->bath; echo '<b> bath: </b>', $row->bed; echo '<b> description: </b>', $row->description; echo '<b> link: </b>', $row->link; } mysqli_free_result($result); } //close connection mysqli_close($db); ?>

your problem here:

echo '<img src="/upload/ " border=0>', $row->photo;

you literally printing empty (probably non-existant) image, followed filename. meant:

echo '<img src="/upload/' . $row->photo . '" border=0>';

php database image mysqli

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -