Jump to content

Need help with displaying pictures!!


ycoleman

Recommended Posts

  :-[ My page will not display images from the database

 

Here is my code:

 

echo "<img>"."$smallimg" . "</img>" . "<a href='ProductList.php?SubCatID=$subcatid'>$productname</a>" ."<p>". "$" ."$unitprice" . ".00". "</p>";

echo ;

 

and this is the variable I defined:

$smallimg = $row['SmallImage'];

Link to comment
https://forums.phpfreaks.com/topic/46064-need-help-with-displaying-pictures/
Share on other sites

The name of the products shows up fine it's just that the pictures will not display:

 

Here is the full code:

<?php error_reporting(E_ALL);
ini_set('display_errors', '1');?>

<?php
if (isset($_GET['SubCatID']))
{
    $thisCatID = (int)$_GET['SubCatID'];
}
else

{
    $thisCatID = 1;
}
?>

<?php //product list
$sql_2 ="SELECT * FROM tblProduct WHERE SubCatID = '".mysql_real_escape_string($thisCatID)."'";
$result = @mysql_query($sql_2,$db) or die(mysql_error());

while($row= mysql_fetch_array($result)){
$smallimg = $row['SmallImage'];
$productname = $row['ProductName'];
$unitprice = $row['UnitPrice'];
$thisCatID =$row['CatID'];
//$description = $row['Description'];

$inventory = $row['Inventory'];
$catid = $row['CatID'];
$subcatid = $row['SubCatID'];

//$largeimg = $row['LargeImage'];


echo "<img>"."$smallimg" . "</img>" . "<a href='ProductList.php?SubCatID=$subcatid'>$productname</a>" ."<p>". "$" ."$unitprice" . ".00". "</p>";
echo ;


}

?>

 

There is a column in the Product table (tblProduct) called SmallImage in the database.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.