--- In ydn-php%40yahoogroups.com">ydn-php
yahoogroups.com, "Tariq" <tariq1654
...> wrote:
>
> I have saved image path & filename in mysql database. But can't
show
> image. Problem is: I want to retrieve image-name from mysql & then
> show the image from stored directory. Can anybody help me?
>
Tariq,
First you do a form:
form.php
<HTML>
<HEAD>
<TITLE>Image_Form</TITLE>
</HEAD>
<BODY>
<form name='form1' method='post' action='show_image.php'>
<table width='100%' border='0' cellspacing='0'>
<tr>
<td width='40%'> </td>
<td width='60%'> </td>
</tr>
<tr>
<td width='40%'><font face='Verdana,Arial,Helvetica,sans-seriif'
size='2'><div align='right'><b>Image Name:</b></div></font></td>
<td width='60%'><input type='text' name='nam' maxlength='60'
size='50'></td>
</tr>
<tr>
<td width='40%'> </td>
<td width='60%'><input type="submit" name="Submit" value="See
image"></td>
</tr>
</table>
</form>
</BODY>
</HTML>
Now, you do the file show_image.php
<?php
if(!isset($_POST["nam"])) {
echo "You didn't write any name";
} else {
$nam = ($_POST["nam"]);
}
//include the conection with your db//
$table = "your table's name";
if(isset($nam)) {
$sql = mysql_query("SELECT * FROM $tabela WHERE //the name of the
field's name//="$nam"");
while($row = mysql_fetch_array($sql)){
$image = $row["name"];
echo "<table width='100%' border='0' cellspacing='0'>";
echo "<tr>";
echo "<td width='20%'> </td>";
echo "<td width='80%'><img src="$image" border='0'></img></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='20%'> </td>";
echo "<td width='80%'><font face='Geneva,Arial,Helevetica,sans-
serif' size='2' color='#000000'>$nam</td>";
echo "</tr>";
}
}
?>
Now, you write the image name in the form and press the bottom "See
the image" .
I think that the image and its name will be showed.
Regards,
Pienkovski
.