As a preface, I'm very new to this so this may be a stupid question, but...
I'm trying to design a website that pulls from a database where I store product information for a "store". This is my code so far.
session_start(); include("connections.php"); $con = mysqli_connect($servername, $username, $password, $database); $sql="SELECT product_title, product_desc, product_image, product_price, product_type FROM tbl_products"; $results=mysqli_query($con, $sql); if(mysqli_num_rows($results) > 0) { while($row=mysqli_fetch_array($results)) { echo $row[0]; echo "<br>"; echo $row[1]; echo "<br>"; echo $row[2]; echo "<br>"; echo $row[3]; echo "<br>"; echo $row[4]; echo "<br>"; } }
mysqli_close($con);
?>
It displays the information fine, but instead of displaying the image, it only displays the filename, for example hoodie(1).jpg. I'm assuming I need to save the images to a database or a folder, but I've tried putting them into my code folder and they still don't show up, any ideas?
P粉4587250402024-04-03 00:27:29
To display an image, use:
echo '';
To upload images, please learn file upload: https://www.tutorialspoint.com/php/php_file_uploading.htm