So, I want to make search results with image in PHP. For example, when you search for a product on a website, you get the search results with images, like this:
So I've created a database with one record only (type: BLOB):
Also, I have a PHP code for display images:
<?php
$server = mysqli_connect("localhost","root","") or die("Não consigo ligar à BD");
mysqli_select_db($server,"pesquisa") or die("Não encontro a BD");
$query = mysqli_query($server, "SELECT * FROM produtos");
while($row = mysqli_fetch_array($query)) {
echo '<img height="300" width="300" src="data:image;base64, '.$row[2].' ">';
}
mysqli_close($server);
?>
But when I run it on a browser, the result is this:
Is this code wrong?