-1

I am unable to show the image in PHP from MySQL blob showing a lot question marks.

below is my code.

if(isset($_GET['edituname']))
{
    $id='<input type="hidden" name="txtuname" value="' . $_GET['edituname'] . '">';
    $sql = "SELECT * FROM andhra WHERE id='" . $_GET['edituname'] ."';";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    $COL_1 = $row['COL_1'];
    $COL_2 = $row['COL_2'];
    $COL_8 = $row['COL_8'];

HTML code is

    <td><img src="data:images\jpg;base64,'.$COL_8.'" /></td>

my workarounds are

if we put header('Content-Type: image/jpeg'); not able to display the URL just two rectangle boxes in left hand corner in browser.

if we change HTML code like below getting some unexpected error.

<td><img src="data:images\jpg;base64,'.($row['COL_8']).'" /></td>
Muhammad Arif
  • 1,014
  • 3
  • 22
  • 56
Hanumaiah T
  • 21
  • 1
  • 9

1 Answers1

-1

try this

 $img = $row['COL_8'];
echo '<td><img src="data:image/jpg;base64,'. $img .'"/></td>';
BlueAries
  • 31
  • 1
  • 8