justAnoob Posted April 2, 2009 Share Posted April 2, 2009 Someone told me that the path that is saved in MySQL is not the path that you would call to display the image. But then I read differently on google. So right now the path below is the path that is saved in MySQL. What else could I try. I just get a little box with an "x" inside it instead of a picture. Here is my code. Any help would be much appreciated. Thanks. <?php mysql_connect("*****","******","*******8"); mysql_select_db("*****"); $sql = mysql_query("SELECT imgpath, x, xx, xxx FROM students"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; echo "<tr> <td><H3>Image </h3></td> <td><H3>x</H3></td> <td><H3>xx</H3></td><td><H3>xxx</H3></td></tr>"; // grab all til no more while ($row = mysql_fetch_array($sql)) { // dispaly in table format echo "<tr><td>"; echo "<img src='/userimages/cars/*.jpg,*.png,*.gif'>"; echo "</td><td>"; echo $row['x']; echo "</td><td>"; echo $row['xx']; echo "</td><td>"; echo $row['xxx']; echo "</td></tr>"; } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/152173-still-cant-get-image-to-dispaly-from-image-path/ Share on other sites More sharing options...
justAnoob Posted April 2, 2009 Author Share Posted April 2, 2009 I tired changing the path to this. /x/x/x is the first 3 letters of my login,,, and xxxxxxx is my full login. But still nothing. <?php echo "<img src='/home/content/x/x/x/xxxxxxx/html/userimages/cars/*.jpg,*.png,*.gif'>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/152173-still-cant-get-image-to-dispaly-from-image-path/#findComment-799186 Share on other sites More sharing options...
justAnoob Posted April 2, 2009 Author Share Posted April 2, 2009 If I put an exact name in the path,,, it works but pulls the same picture for every entry..I would like the pictures to dispaly like the other rows in the database, row by row.. <?php echo "<img src='/userimages/cars/1238640191.jpg'>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/152173-still-cant-get-image-to-dispaly-from-image-path/#findComment-799189 Share on other sites More sharing options...
justAnoob Posted April 2, 2009 Author Share Posted April 2, 2009 I guess the question is how do i let it know that <?php echo $row['imgpath']; ?> is actually this for each image in that row <?php <img src='/userimages/cars/'> ?> Quote Link to comment https://forums.phpfreaks.com/topic/152173-still-cant-get-image-to-dispaly-from-image-path/#findComment-799196 Share on other sites More sharing options...
premiso Posted April 2, 2009 Share Posted April 2, 2009 I take it this is what you are after: $images = glob($row['imgpath']. "{*.gif, *.jpg, *.png}", GLOB_BRACE); foreach ($images as $image) { echo "<img src='{$image}' />"; // either that or echo "<img src='{$row['imgpath']}{$image}' />"; (whichever one works) } Quote Link to comment https://forums.phpfreaks.com/topic/152173-still-cant-get-image-to-dispaly-from-image-path/#findComment-799518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.