Code:
CREATE TABLE tbl_images (
id tinyint(3) unsigned NOT NULL auto_increment,
image blob NOT NULL,
PRIMARY KEY (id)
);
`id` is the unique id for the table row. This is the primary key. `img_name` field stores the image name. `img_type` stores the information about the type of images like JPG or GIF etc. `img_size` holds the size of the image and img_data stores the actual image file.
Code:
// Create MySQL login values and
// set them to your login information.
$username = "YourUserName";
$password = "YourPassword";
$host = "localhost";
$database = "binary";
// Make the connect to MySQL or die
// and display an error.
$link = mysql_connect($host, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
// Select your database
mysql_select_db ($database);
Bookmarks