0

Hi,
the code below is trying topull out the image from the database. When the image code is taken before the text that is being displayed from the database then it pulls out the image. if the code is written after the text being displayed from the database then it does not work. can some one help me please.

many thanks

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?
$username="proper_asik112";
$password="ashik112";
$database="proper_contacts";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query('SELECT * FROM contacts 
WHERE id=\''. $_GET['id'].'\'');; 
?>
<?
while($row=mysql_fetch_array($result))
{

echo ' '. $row['first'] .' '. $row['last'] .' ';

}
?>
<img name="fff" img src="<? while($row=mysql_fetch_array($result))
{
echo ''. $row['picture'] .'';
}
?>" width="529" height="374" alt=""> 

</body>
</html>
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by sDJh
0

I would solve it a bit different, because some browsers have problems displaying images like this.

Write another PHP-File that just outputs the image. Then use

<a href="image.php?id=1">

in your first script.

I hope that helps.
Simon

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.