Display Images from DB

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matrixx1
Forum Newbie
Posts: 8
Joined: Fri Apr 15, 2011 1:04 am

Display Images from DB

Post by matrixx1 »

I'm creating a funeral home site and on the side of the page I would like to display the last 5 funeral obituaries that are in mySQL database (name and certain sized image (images are in "image" field) w/ a link to an "obituaries detail page for the individual deceased person"). I am able to do this successfully listing only the names....how can I list the image associated with the name? This is what I have so far:

Code: Select all

<?php

include("connect.php");

?>

Code: Select all

<?php

$query = "SELECT id, deceased_name, deceased_date, DATE_FORMAT(deceased_date, '%M %D, %Y') as datetext";
$query .= " FROM scales_obits ORDER BY deceased_date DESC LIMIT 5";

$listings = mysql_query($query);
if (!listings) {
	echo("<p>Error retrieving listings from lookup table<br>".
		"Error: " . mysql_error());
	exit();
}

echo("<table border=\"0\" width=\"100%\" class=\"obit\">");

while ($listing = mysql_fetch_array($listings)) {

$deceased_name = $listing["deceased_name"];
$deceased_date = $listing["datetext"];
$id = $listing["id"];

echo("<tr><td width=\"100%\"><a href=\"obitdetail.php?id=".$id."\"><strong>".$deceased_name."</strong></a></td><td>&nbsp;</td>");


}

echo("</table>");
?>
matrixx1
Forum Newbie
Posts: 8
Joined: Fri Apr 15, 2011 1:04 am

Re: Display Images from DB

Post by matrixx1 »

never-mind the issue has been solved.
Post Reply