Home  >  Article  >  Backend Development  >  PHP processing code for extracting binary images from the database_PHP tutorial

PHP processing code for extracting binary images from the database_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:44:46934browse

image.php file

Copy code The code is as follows:

$conn=@mysql_connect(" localhost","root","123") or die("Server connection error!"); //Link database
@mysql_select_db("upload",$conn) or die("No database found!");
$query="select * from upfile where ftag=$fn";
$result=mysql_query($query);
if(!$result) die("error: mysql query");
$num=mysql_num_rows($result);
if($num<1) die("error: no this recorder");
$data = mysql_result($result,0,"picture");
header("Content-type: image/JPEG",true);
echo $data;
?>

The above is the image extraction
frontend display file
Copy code The code is as follows:


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320489.htmlTechArticleimage.php file copy code code is as follows: ?php $conn=@mysql_connect("localhost","root" ,"123") or die("Server connection error!"); //Link database @mysql_select_db("upload",$conn) o...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn