php 從數(shù)據(jù)庫提取二進制圖片的處理代碼
更新時間:2009年09月09日 21:57:49 作者:
形式上類似UCH 只是存儲方式不一樣 本人比較愚鈍 這個問題困惑了我半天 希望對有同樣問題的phper有所幫助 高手們別見笑!
image.php文件
<?php
$conn=@mysql_connect("localhost","root","123") or die("服務器連接錯誤!"); //鏈接數(shù)據(jù)庫
@mysql_select_db("upload",$conn) or die("未發(fā)現(xiàn)數(shù)據(jù)庫!");
$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;
?>
上面是圖片提取
前臺顯示文件
<img src="image.php?fn=<?php echo $fn;?>">
復制代碼 代碼如下:
<?php
$conn=@mysql_connect("localhost","root","123") or die("服務器連接錯誤!"); //鏈接數(shù)據(jù)庫
@mysql_select_db("upload",$conn) or die("未發(fā)現(xiàn)數(shù)據(jù)庫!");
$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;
?>
上面是圖片提取
前臺顯示文件
復制代碼 代碼如下:
<img src="image.php?fn=<?php echo $fn;?>">
相關文章
淺析php中三個等號(===)和兩個等號(==)的區(qū)別
以下是對php中三個等號(===)和兩個等號(==)的區(qū)別進行了詳細的分析介紹,需要的朋友可以過來參考下2013-08-08ThinkPHP使用心得分享-ThinkPHP + Ajax 實現(xiàn)2級聯(lián)動下拉菜單
聯(lián)動菜單的數(shù)據(jù)存在數(shù)據(jù)庫,可以隨時通過對數(shù)據(jù)庫添加刪除修改改變菜單數(shù)據(jù),而不需修改代碼,同時,實現(xiàn)了2級后,也可以實現(xiàn)3級,4級。。。等關聯(lián)菜單2014-05-05PHP編碼規(guī)范-php coding standard
標準化問題在某些方面上讓每個人頭痛,讓人人都覺得大家處于同樣的境地。這有助于讓這些建議在許多的項目中不斷演進,許多公司花費了許多星期逐子字逐句的進行爭論。2007-03-03