Page 1 of 1

Display Images from DB

Posted: Fri Apr 15, 2011 1:15 am
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>");
?>

Re: Display Images from DB

Posted: Fri Apr 15, 2011 9:18 am
by matrixx1
never-mind the issue has been solved.