Good day forum:
I need some assitance retrieving and displaying an image. I have stored image in a directory on my server and saved its name in mysql. I'm able to retrieve and display all images on a page in the following way.
<?php
// Connects to your Database
include 'datalogin.php';//
//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM images ") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data ))
{
//Outputs the image and other data
Echo "<img src=http://www.mysite.com/andy/images/clientsimages/".$info['uploadedfile'] ."> <br>";
Echo "<b>Client ID:</b> ".$info['clientid'] . "<br> ";
}
?>
Now, I'm trying to incorporate an image into a form that is populated with other information based on a specified id.
The specified area of my form where the image is to be displayed is as follows:
//get image details
$uploaddir = "images/clientsimages/";
$get_imagedetails = "select uploadedfile from images
where clientid = $_POST[sel_id]";
$get_imagedetails_res = mysql_query($get_imagedetails);
if(!$get_imagedetails){
die("Error: ".mysql_error());
}
if (mysql_num_rows($get_imagedetails_res) > 0)
{
//$display_block .= "<P><strong>Cutomer Picture</strong><br>
//<u1>";
while ($imagedetails_info = mysql_fetch_array($get_imagedetails_res))
{
$uploadedfile = $imagedetails_info['uploadedfile'];
$image=$uploadedfile;
}
}
$display_block .="<div style=\"position: absolute; width: 115px; height: 140px; z-index: 1; left: -200px; top: 8px; background-color:#000000\" id=\"layer3\">";$display_block .=" <DIV style=\"position: absolute; left: 5px; top: 6px\" name=\"cutomerimage\" id=\"cutomerimage\"><img src=\"$uploaddir".$info['uploadedfile'] ."\" border=\"1\" width=\"104\" height=\"119\"> </DIV>";
I've been trying the code above without any success. May I request some assistance?