PHP PDO: Working With BLOBs
We can store images or other document into database (such as MySQL). For this job, we will work with BLOB field in table. Ok, let’s do it!
First, create a table that have BLOB file. I will create table named “books”:
CREATE TABLE `books2` ( `id` int(11) NOT NULL auto_increment, `title` varchar(150) NOT NULL, `author` varchar(150) NOT NULL, `description` varchar(255) NOT NULL, `on_sale` tinyint(1) NOT NULL, `cover` blob NOT NULL, PRIMARY KEY (`id`) );
0 comments:
Post a Comment