Home >Database >Mysql Tutorial >How to Display MySQL Database Images in HTML Using PHP?
In order to retrieve images from a MySQL database and display them in an HTML tag, the PHP variable $result must be passed into the HTML. However, this cannot be done directly.
To resolve this issue, a separate PHP script (e.g., getImage.php) should be created to return the image data.
Modified catalog.php:
<body> <img src="getImage.php?id=1" width="175" height="200" /> </body>
Content of getImage.php:
<?php $link = mysqli_connect("localhost", "root", "", "dvddb"); $sql = "SELECT dvdimage FROM dvd WHERE>
The above is the detailed content of How to Display MySQL Database Images in HTML Using PHP?. For more information, please follow other related articles on the PHP Chinese website!