So i have the PHP code to call and display the product from mysql.. i have a problem with displaying the picture.. when a user add the item to database, (database as shown in picture) when the picture is uploaded, its store in a folder in localhost and on the database.. it will auto create a random number for the picture to store.. so how should i call the picture to be viewed? in line:
img/ is the folder in localhost.
DATABASE EXP:
<?php
// Run a select query to get my letest 6 items
// Connect to the MySQL database
include "dbconnect.php";
$dynamicList = "";
$sql = mysql_query("SELECT * FROM product ORDER BY proDate DESC LIMIT 6");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$proID = $row["proID"];
$proName = $row["proName"];
$proPrice = $row["proPrice"];
$proDate = strftime("%b %d, %Y", strtotime($row["proDate"]));
$dynamicList .= '
<div class="single-product">
<div class="product-f-image">
<img src="img/' . $proID . '.jpg" alt="">
<div class="product-hover">
<a href="#" class="add-to-cart-link"><i class="fa fa-shopping-cart"></i> Add to cart</a>
<a href="single-product.php?id=' . $proID . '" class="view-details-link"><i class="fa fa-link"></i> See details</a>
</div>
</div>
<h2>' . $proName . '</h2>
<div class="product-carousel-price">
<ins>$' . $proPrice . '</ins> <del>$425.00</del>
</div>
</div>
';
}
} else {
$dynamicList = "no new products";
}
mysql_close();
?>
<?php echo $dynamicList; ?>
</div>