Mysql中数据类型保存为二进制数,select语句读出来的是什么 最近在做一个权限管理的东西,有一个数据保存为二进制数,问一下怎么读出来? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 好像用select读出来就不是原来的数据了 http://blog.csdn.net/yuzhengyang0720/article/details/5967650orhttp://hi.baidu.com/underalight/item/171ae2b5f72ffe901946978f仅供参考 别的不说了,直接贴代码:<?php if(!isset($id) or $id=="") die("error: id none"); //定位记录,读出 $conn=mysql_connect("127.0.0.1","***","***"); if(!$conn) die("error : mysql connect failed"); mysql_select_db("test",$conn); $sql = "select * from receive where id=$id"; $result = mysql_query($sql); $num=mysql_num_rows($result); if($num<1) die("error: no this recorder"); $data = mysql_result($result,0,"file_data"); $type = mysql_result($result,0,"file_type"); $name = mysql_result($result,0,"file_name"); mysql_close($conn); //先输出相应的文件头,并且恢复原来的文件名 header("Content-type:$type"); header("Content-Disposition: attachment; filename=$name"); echo $data; ?> 2进制数据的读取好像是需要unpack()去解析的,而且你还的晓得这 2进制数据 写进去时是什么类型(数据类型); 为什么date得到时间跟机器时间不一样? 采集utf-8页面内容中的“汉字”抓取进数据库出现乱码 请教各位大虾,php网站发布 关于php使用dtree实现动态目录的问题 读取文件出错,帮解决! 求救,碰到一个怪问题 js与 php的问题 请问php中有没有整除函数?急,多谢 我安装好PHP后,在浏览的时候,出现在一个问题,请高手指点 请帮我看下这是什么编码?(内有截图) PHP如何把一个form表单多个值提交到一个字断中 请问windows下有没有秒级的计划任务
if(!isset($id) or $id=="") die("error: id none");
//定位记录,读出
$conn=mysql_connect("127.0.0.1","***","***");
if(!$conn) die("error : mysql connect failed");
mysql_select_db("test",$conn);
$sql = "select * from receive where id=$id";
$result = mysql_query($sql); $num=mysql_num_rows($result);
if($num<1) die("error: no this recorder");
$data = mysql_result($result,0,"file_data");
$type = mysql_result($result,0,"file_type");
$name = mysql_result($result,0,"file_name");
mysql_close($conn);
//先输出相应的文件头,并且恢复原来的文件名
header("Content-type:$type");
header("Content-Disposition: attachment; filename=$name");
echo $data;
?>