Skip to main content
Post Closed as "Duplicate" by CommunityBot

I've uploaded an image and text directly to my table through phpMyAdmin. However when it comes to displaying, the images are showing up as junk text. What could be the issue? The image is a relatively small jpg file. Here is the code:

<?php  require_once 'login.php';  $conn = new mysqli($hn, $un, $pw, $db);  if($conn->connect_error) die($conn->connect_error);  $query = "SELECT * from classics";  $result = $conn->query($query);  if(!$result) die($conn->error);  $rows = $result->num_rows;  for($j=0; $j < $rows; $j++)   {   $result->data_seek($j);   $row=$result->fetch_array(MYSQLI_ASSOC);     echo 'Cover:' .$row['sleeve'] .'<br>';   }  $result->close();  $conn->close(); ?> 

I've uploaded an image and text directly to my table through phpMyAdmin. However when it comes to displaying, the images are showing up as junk text. What could be the issue? The image is a relatively small jpg file. Here is the code:

<?php require_once 'login.php'; $conn = new mysqli($hn, $un, $pw, $db); if($conn->connect_error) die($conn->connect_error); $query = "SELECT * from classics"; $result = $conn->query($query); if(!$result) die($conn->error); $rows = $result->num_rows; for($j=0; $j < $rows; $j++)  { $result->data_seek($j); $row=$result->fetch_array(MYSQLI_ASSOC);    echo 'Cover:' .$row['sleeve'] .'<br>';  } $result->close(); $conn->close(); ?> 

I've uploaded an image and text directly to my table through phpMyAdmin. However when it comes to displaying, the images are showing up as junk text. What could be the issue? The image is a relatively small jpg file. Here is the code:

<?php  require_once 'login.php';  $conn = new mysqli($hn, $un, $pw, $db);  if($conn->connect_error) die($conn->connect_error);  $query = "SELECT * from classics";  $result = $conn->query($query);  if(!$result) die($conn->error);  $rows = $result->num_rows;  for($j=0; $j < $rows; $j++) {   $result->data_seek($j);   $row=$result->fetch_array(MYSQLI_ASSOC);   echo 'Cover:' .$row['sleeve'] .'<br>';  }  $result->close();  $conn->close(); ?> 
Source Link
Agni Scribe
  • 252
  • 3
  • 18

PHP-SQL: Uploaded image displaying as junk text

I've uploaded an image and text directly to my table through phpMyAdmin. However when it comes to displaying, the images are showing up as junk text. What could be the issue? The image is a relatively small jpg file. Here is the code:

<?php require_once 'login.php'; $conn = new mysqli($hn, $un, $pw, $db); if($conn->connect_error) die($conn->connect_error); $query = "SELECT * from classics"; $result = $conn->query($query); if(!$result) die($conn->error); $rows = $result->num_rows; for($j=0; $j < $rows; $j++) { $result->data_seek($j); $row=$result->fetch_array(MYSQLI_ASSOC); echo 'Cover:' .$row['sleeve'] .'<br>'; } $result->close(); $conn->close(); ?>