andy11 Posted April 24, 2007 Share Posted April 24, 2007 I've been trying to echo images from a database into both an html table (in rows of five) and into a div for many days. I will come back to the table later but I could use some help with the divs. It was easy to echo out the fields as shown but the actual image, well not yet. The commented out echoes are the problem. It needs to have both the image and the substr (0, -4) load into a single div. I also need to set a specific width to force proportional sizing and I'm sure that get's added to the echoed image tag. Can someone help? Here is my code; <?php require ("connection.php"); $result = "SELECT * FROM products"; $product_query = mysql_query($result); $product_count = mysql_num_rows($product_query); while($row = mysql_fetch_array( $product_query )) { $src = $product['product']; $name = substr($product, 0, -4); echo "<div id=\"image\">"; echo $row['product']; //echo "<img src='$src' alt='' />"; echo "<div id=\"name\">"; echo $row['catagories']; //echo $name; echo "</div></div>"; echo "<br/>"; } ?> Thank you Link to comment https://forums.phpfreaks.com/topic/48532-echo-images-and-substr-from-single-field-in-database-into-html-divs/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.