I am trying to fetch an image from database and display in my webpage through pdo,

Image is not displaying instead it appears as "lº·“w~ïFVÅà%@|vmŸú¿E8Ö®?ð²ý>ñNòTML°^¯F®Ìü9ù²÷fÕèÕÙ³îç®^éª@1 ½§~îþlY4º7ñZS,,¾³Ö9ú7“cÐ5z4v^[éÙý¹Yõú¨Ôè—fkIrÓ·knó~þRmü2¶: %@Ì®Òß ¸t¾•ÈáºG¼Ohý¤øtå’ÿêÙ·/÷G£cЖ1ñ:;¶¡œý‘º[[mÇ+-·ŸÕµÈàuæžwvÇ=¹Þì»tUÀñäÏòå챃µ8§ÙN¹uòÄx].Mr+Ñœ–­<¥©c§•éõ¼“=/‹" -

MY Code is.,

    <div class = "controlbox">

<form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "get">
<select name = "rowno" onchange = "javascript:document.forms[0].submit();">
  <option>--Select a Domain--</option>

<?php
try
{$db = new PDO('mysql:host=localhost;dbname=nativelead', 'newmellow', 'db@nativelead');}
catch( PDOException $e )
{die( $e->getMessage() );}

$sql = 'SELECT * FROM ind_register';
$result = $db->query($sql);


while ($row = mysql_fetch_object($result)) {
    echo '<img src="image.php?ind_reg_id=' . $row->ID . '">';
}





$rowarray = $result->fetchall(PDO::FETCH_ASSOC);
$rowno = 0;


foreach($rowarray as $row)
{
echo "<option value = $rowno >$row[ind_reg_focus] </option>";
$rowno++;

}
?>
</select>
</form>
</div>



<?
if ($_GET[rowno])
{
$rowno = $_GET[rowno];}
else
{$rowno = 0;}

$row = $rowarray[$rowno];
echo "<h2>$row[ind_reg_focus]</h2>";
echo "<h3>$row[ind_reg_name]</h3>";
echo "<h3>$row[ind_reg_id]</h3>";
echo "<img src="data:image/jpeg;base64,'.base64_encode($pics).'"/>";



echo "<table id='otable'>";



?>
<?
echo "</table>";
?>

How do i overcome this??

Thanks in advance.

im sensing the line 53 of yours is an error

echo "<img src="data:image/jpeg;base64,'.base64_encode($pics).'"/>";

would you try to decode that part that may help

I guess it would be something like this

base64_decode($pics)

yes?

sry this is not working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.