Forum Moderators: coopster

Message Too Old, No Replies

Image not showing up

Stored Image URL not showing up

         

antonio123

9:42 pm on May 13, 2009 (gmt 0)

10+ Year Member



Hello All (Once again!) :)

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);
?>

antonio123

10:19 pm on May 13, 2009 (gmt 0)

10+ Year Member



No help guys? PLEAASE!

Thanks!

eelixduppy

3:32 am on May 14, 2009 (gmt 0)



Are you getting any errors in your error log? Output to the browser?

Pico_Train

5:47 am on May 14, 2009 (gmt 0)

10+ Year Member



This is a little fix.

echo "<td>" "<img src='" . $row['imageurl'] . "'>""</td>";

You are also selecting imageurl twice in your query.

Don't know if that will help.

try print_r($result); or print_r($row); to see if your query actually gets anything as well