PHP processing code for extracting binary images from the database_PHP tutorial

WBOY
Release: 2016-07-21 15:44:46
Original
934 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!