Page 1 of 1
Retrieve images from database not shown in firefox.
Posted: Thu Feb 12, 2009 3:54 am
by asad_black
Code: Select all
<?php
Header("Content-type: image/jpeg");
$var = @$_GET['q'] ;
$trimmed = trim($var);
$con = mysql_connect("localhost","sample","sample");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("sample", $con);
$sql = mysql_query("SELECT * FROM links");
while($row = mysql_fetch_array($sql))
{
echo $row['title'];
echo "<center><img height='200' width='200' src='".$row['image']."'></img><br><br><br></center>";
//echo "<img src='".$row['imgdata']."'>";
echo $row['link'];
echo "<br />";
}
mysql_close($con);
?>
its work correctly on IE but in fire fox it shows the path of the PHP file...!
Output in firefox =
http://localhost/mywork/asad_black/view_records.php
Re: Retrieve images from database not shown in firefox.
Posted: Thu Feb 12, 2009 10:01 am
by Christopher
Please use
Code: Select all
tags when posting code. And no one else can see your 'localhost' server.
What does the generated <img> tag URL look like? Is is a relative path or have 'http://' in the URL?
Re: Retrieve images from database not shown in firefox.
Posted: Thu Feb 12, 2009 1:32 pm
by bugrush
you are setting content type to image/jpeg and outputting html
Re: Retrieve images from database not shown in firefox.
Posted: Thu Feb 12, 2009 10:31 pm
by asad_black
give me a solution
Re: Retrieve images from database not shown in firefox.
Posted: Thu Feb 12, 2009 10:51 pm
by John Cartwright
No please? How impolite...
Anyhow.. remove the header() call. You are setting the content type to something other than what your outputting (as bugrush pointed out)
Re: Retrieve images from database not shown in firefox.
Posted: Fri Feb 13, 2009 1:34 am
by asad_black
thankx for the participation my problem has been solved...!
by removing header content...!