justAnoob Posted April 2, 2009 Share Posted April 2, 2009 Still can't get image to display,,, just the image path. <?php // "<img src='/userimages/cars/>" this is the image path where the pics are echo "<tr><td>"; echo $row['imgpath']; //this only echos the actuall image path, not the pic ?> <?php echo "<img src='/userimages/cars/pic.jpg>"; //if i enter one of the picture names in the code, the same picture is for every entry displayed, so atleast i know that the path is correct and the images will display. ?> this might help showing you the whole script. <?php mysql_connect("xxxxxx","xxxxx","xxxxx"); mysql_select_db("xxxxxx"); $sql = mysql_query("SELECT imgpath, item_name, description, in_return FROM xxxxxx"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; echo "<table border=1> <tr> <td><H3>Image </h3></td> <td><H3>Item Name</H3></td> <td><H3>Description</H3></td><td><H3>Seeking</H3></td></tr>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td>"; echo $row['imgpath']; echo "</td><td>"; echo $row['item_name']; echo "</td><td>"; echo $row['description']; echo "</td><td>"; echo $row['in_return']; echo "</td></tr>"; } echo "</table>"; ?> so it has to be something minor to get the images to display for each row of the datase Link to comment https://forums.phpfreaks.com/topic/152301-solved-help-with-a-couple-lines/ Share on other sites More sharing options...
jonsjava Posted April 2, 2009 Share Posted April 2, 2009 <?php mysql_connect("xxxxxx","xxxxx","xxxxx"); mysql_select_db("xxxxxx"); $sql = mysql_query("SELECT imgpath, item_name, description, in_return FROM xxxxxx"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; echo "<table border=1> <tr> <td><H3>Image </h3></td> <td><H3>Item Name</H3></td> <td><H3>Description</H3></td><td><H3>Seeking</H3></td></tr>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td>"; echo "<img src=\"".$row['imgpath']."\">"; echo "</td><td>"; echo $row['item_name']; echo "</td><td>"; echo $row['description']; echo "</td><td>"; echo $row['in_return']; echo "</td></tr>"; } echo "</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/152301-solved-help-with-a-couple-lines/#findComment-799807 Share on other sites More sharing options...
thebadbad Posted April 2, 2009 Share Posted April 2, 2009 Your HTML is malformed (missing quote around image path). If $row['imgpath'] holds the image path, i.e. /userimages/cars/pic.jpg, this should work: while loop excerpt <?php while ($row = mysql_fetch_array($sql)) { echo "<tr><td>"; echo '<img src="' . $row['imgpath'] . '" alt="" />'; echo "</td><td>"; echo $row['item_name']; echo "</td><td>"; echo $row['description']; echo "</td><td>"; echo $row['in_return']; echo "</td></tr>"; } ?> Edit: Got beaten Link to comment https://forums.phpfreaks.com/topic/152301-solved-help-with-a-couple-lines/#findComment-799811 Share on other sites More sharing options...
justAnoob Posted April 2, 2009 Author Share Posted April 2, 2009 thanks everyone. Link to comment https://forums.phpfreaks.com/topic/152301-solved-help-with-a-couple-lines/#findComment-799812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.