Home > php教程 > php手册 > PHP将图片存入mysql实现代码

PHP将图片存入mysql实现代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:08:11
Original
944 people have browsed it

php教程将图片存入mysql教程实现代码
下面只告诉你如何实现图片如何保存到数据库教程,不推荐此种方法。
*/

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 ;

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template