princeofpersia Posted September 8, 2011 Share Posted September 8, 2011 Hi guys, I have page where it echos out the image url from mysql in a MAMP Server, however when i echo the image url out it seems to be fine but as soon as i put in a img scr it wont show the image but it shows the container. I have the code here <div id="maincontentholderbottom"> <div id="maincontentholderbottom-index-left"> <div id="news-container"><ul> <?php $select=mysql_query("SELECT * FROM news"); while($get_news=mysql_fetch_array($select)){ $newsid=$get_news['id']; $title=$get_news['title']; $text=$get_news['text']; $newsdate=$get_news['date']; $newstime=$get_news['time']; $imagelink=$get_news['newsimagelink']; $newstext=substr($text, 0, 420); echo"<li><div id='title'>$title</div><div id='newsblock'>$newstext... <a href='http://localhost/mycomputer/create/news/index.php?id=$newsid'>Read More</a></div> <div id='newsimage'><img src='$imagelink' width='150' height='70'/></div> </li>"; } ?> </ul> </div> </div> </div> Do u know why is it like this? I appreciate your help in advance. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/246710-show-image-from-mysql-in-php/ Share on other sites More sharing options...
JKG Posted September 8, 2011 Share Posted September 8, 2011 try <?php echo "<img src='".$imagelink."' width='150' height='70'/>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/246710-show-image-from-mysql-in-php/#findComment-1266901 Share on other sites More sharing options...
radiations3 Posted September 8, 2011 Share Posted September 8, 2011 try <?php echo "<img src='".$imagelink."' width='150' height='70'/>"; ?> You can also try under <html> //$pic contains the path of image <img src = "<?php echo $pic; ?>" width="100" height="100" /> </html> Quote Link to comment https://forums.phpfreaks.com/topic/246710-show-image-from-mysql-in-php/#findComment-1266911 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.