最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
PHP将图片存入mysql实现代码
时间:2010-11-25 编辑:简简单单 来源:一聚教程网
下面只告诉你如何实现图片如何保存到数据库教程,不推荐此种方法。
*/
mysql_connect('localhost','root','root');
mysql_select_db('ac');
$picdir ="/a/ag.gif";
$image = addslashes(file_get_contents($picdir));
$sql ="insert into tbl_name (field) values ('" . $image . "')";
mysql_query($sql);
/*
--
-- 表的结构 `test`
--
create table if not exists `test` (
`id` int(8) not null auto_increment,
`title` char(150) default null,
`content` longblob,
`addnewcolumn` varchar(20) not null,
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=1 ;
相关文章
- php+mysql图片输入输出 03-28
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24