0

I know that I'm using depreciated MySQL, that the page will be very heavy, and I should be linking the image files into the database rather than inserting them directly there. Besides that, I'm having trouble displaying the BLOB images from the database table "builds" in column "image".

Here is my code: Issues displaying opening and closing PHP tags.

PHPMyAdmin Picture:enter image description here

Webpage Display: enter image description here

include ("connect.php");
$conn = mysql_connect("localhost", $id, $pw); //Start of Establishing Connection to Database "akimble"
if (!$conn) {
    die ("Error connecting: " . mysql_error()); //Displays What the Error was if Present
}
mysql_select_db($db, $conn);
$sql = "SELECT * FROM builds"; //Selects Everything From the Table "userinfo" in "akimble" Database
$results = mysql_query($sql, $conn); //Assigning all Data

echo "<table cellpadding=10 border=1>
<tr>
    <th>User ID</th>
    <th>Image Name</th>
    <th>Image</th>
</tr>";

while ($entries = mysql_fetch_array($results)) { //Fetch all Information within "results" Variable
    echo "<tr>";
        echo "<td>" . $entries['id'] . "</td>";
        echo "<td>" . $entries['name'] . "</td>";
        header("Content-type: image/jpg");
        echo '<img src="data:image/jpg;base64,' . base64_encode( $row['image'] ) . '" />';
    echo "</tr>";
                                                }
echo "</table>";

mysql_close($conn);

Thanks for the help, I've been struggling for hours on this.

Musa
  • 96,336
  • 17
  • 118
  • 137
Aramza
  • 193
  • 7
  • 29

1 Answers1

0

$row is not defined then how can u get the index image from that

You have fetched all the mysql results to variable named $entries so use $entries['image']

 echo '<img src="data:image/jpg;base64,' . base64_encode( $entries['image'] ) . '" />';
echo "</tr>";