elviapw Posted March 2, 2009 Share Posted March 2, 2009 I'm stumped-- I'm trying to display more than one image from a server via its url in a mysql database. the first image works fine, but the second two images just won't show up. I've checked the database and I know the image_url2 is there for the second image I want to display. here's the code: <?php $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $pic = $feed['image_url']; $pic2 = $feed['image_url2']; $pic3 = $feed['image_url3']; echo "<tr >\n"; echo "<td >\n"; echo "<a href=\'archive.php'><font face='Georgia, Times New Roman, Times, serif' color='#999999'>$title</font></a>\n"; echo "<p>$date</p><br/>"; echo " <p>$post</p><br/>\n"; if ( !empty($feed['image_url']) ) { echo "<img src= '$pic'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url2']) ) { echo "<img src= '$pic2'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url3']) ) { echo "<img src= '$pic3'/><br/><br/>"; } else { echo " "; } echo " <a href='delete.php'>delete this p0st</a>\n"; echo "<hr />\n"; echo "</td >\n"; echo "</tr>\n"; } echo "</table>\n"; echo "</center>"; echo"<a style='text-decoration:none' href='/archive.php'><font color='#FF6600'><center>archive</center></font></a>"; } echo"</body> </html>" ?> Quote Link to comment https://forums.phpfreaks.com/topic/147501-solved-display-more-than-one-image-php/ Share on other sites More sharing options...
RussellReal Posted March 2, 2009 Share Posted March 2, 2009 $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; you are not selecting it try: $sql = "SELECT Title, Content, Date, image_url, image_url2 FROM Posts ORDER BY id DESC"; Quote Link to comment https://forums.phpfreaks.com/topic/147501-solved-display-more-than-one-image-php/#findComment-774279 Share on other sites More sharing options...
elviapw Posted March 2, 2009 Author Share Posted March 2, 2009 that was silly! thanks so much ! Quote Link to comment https://forums.phpfreaks.com/topic/147501-solved-display-more-than-one-image-php/#findComment-774302 Share on other sites More sharing options...
RussellReal Posted March 2, 2009 Share Posted March 2, 2009 Anytime bro Feel free to add me to MSN to ask questions Quote Link to comment https://forums.phpfreaks.com/topic/147501-solved-display-more-than-one-image-php/#findComment-774307 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.