PHP saves pictures into mysql implementation code_PHP tutorial

WBOY
Release: 2016-07-13 17:05:20
Original
1006 people have browsed it

php tutorial to save images into mysql tutorial implementation code
The following only tells you how to save images to the database. This method is not recommended.
*/

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);

/*
--
-- Table structure `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 ;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630780.htmlTechArticlephp tutorial to save pictures to mysql tutorial implementation code The following only tells you how to implement how to save pictures to the database tutorial, no This method is recommended. */ mysql_connect('localhost','root','r...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template