ycoleman Posted April 7, 2007 Share Posted April 7, 2007 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 More sharing options...
MadTechie Posted April 7, 2007 Share Posted April 7, 2007 Thats not much to work with we're need to see more code does the ProductList.php work manually ? Link to comment https://forums.phpfreaks.com/topic/46064-need-help-with-displaying-pictures/#findComment-223811 Share on other sites More sharing options...
ycoleman Posted April 7, 2007 Author Share Posted April 7, 2007 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. Link to comment https://forums.phpfreaks.com/topic/46064-need-help-with-displaying-pictures/#findComment-223833 Share on other sites More sharing options...
MadTechie Posted April 7, 2007 Share Posted April 7, 2007 the forum messed up a few things as it wasn't in the [ code] tags can you echo $smallimg before displaying the image to see what it returns Link to comment https://forums.phpfreaks.com/topic/46064-need-help-with-displaying-pictures/#findComment-223854 Share on other sites More sharing options...
AndyB Posted April 8, 2007 Share Posted April 8, 2007 "<img>"."$smallimg" . "</img>" What kind of html is that meant to be? Link to comment https://forums.phpfreaks.com/topic/46064-need-help-with-displaying-pictures/#findComment-223860 Share on other sites More sharing options...
MadTechie Posted April 8, 2007 Share Posted April 8, 2007 oh i thought the forum did that Link to comment https://forums.phpfreaks.com/topic/46064-need-help-with-displaying-pictures/#findComment-223879 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.