开发者

Image Not Displaying Or Error Containts

开发者 https://www.devze.com 2023-02-27 06:31 出处:网络
how i can display image in my web browser using php from mysql database i have all ready uploaded image in database

how i can display image in my web browser using php from mysql database i have all ready uploaded image in database

for display the image i am writting this code file name is down.php and calling that page through post matho开发者_Go百科d but there is problem occurring can any budy solve my problem i want to give thanks in advance

output is like this->

#%'%#//33//@@@@@@@@@@@@@@@


You'd use some code similar to this:

$photoid = 1 // Set to the actual id of your photo.

// Query your database
$query = "SELECT * FROM `phototable` WHERE `photoid`='".mysql_real_escape_string($photoid)."';";
$result = mysql_query($query, $link);

// Quick error check
if (!$result) {
  echo "DB Error, could not query the database\n";
  echo 'MySQL Error: ' . mysql_error();
  exit;
}

// Output the image
$row = mysql_fetch_assoc($result);
header('Content-Type: image/jpg'); // assuming your photo is jpg
echo $row[photodata];
0

精彩评论

暂无评论...
验证码 换一张
取 消