Home > Article > Backend Development > Decimal to binary PHP processing code for extracting binary images from the database
image.php file
Copy code The code is as follows:
$c or die("Server connection error!"); //Link to database
@mysql_select_db("upload",$conn ) or die("Database not 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;
?>
Copy the code The code is as follows:
The above introduces the decimal to binary PHP processing code for extracting binary images from the database, including the content of decimal to binary conversion. I hope it will be helpful to friends who are interested in PHP tutorials.