Forum Moderators: coopster
I have the URL's of product images stored in my MySQL database. I am trying to retrieve the images and display them in the table below but nothing happens when I run the code below. I think it has to do with the ImageURL field I am trying to get.
Can someone please help!
Thank you!
CODE:
<?php
$q=$_GET["q"];
$con = mysql_connect('IPAddress", 'username', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$sql="SELECT distinct manufacturer_name, vendor_id, name, manufacturer_sku, id, imageurl, CONCAT('$',MIN(ABS(SUBSTRING_INDEX(price,'$',-1)))) AS price,
CONCAT('$',MIN(ABS(SUBSTRING_INDEX(sale_price,'$',-1)))) AS saleprice,
imageurl, description FROM products WHERE vendor_id = '".$q."' GROUP BY manufacturer_sku
ORDER BY id";
$result = mysql_query($sql);
echo "<table class='reference' cellspacing='0' cellpadding='0' border='1' width='100%'>
<tr>
<th>Picture of Ring</th>
<th>Ring Name</th>
<th>Sale Price</th>
<th>Store Name</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" "<img src=" . $row['imageurl'] . ">""</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['saleprice'] . "</td>";
echo "<td>" . $row['manufacturer_name'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>