如何在数据库中保存图像?

I want to save images in a mysql database. I read one option:

INSERT INTO tblname(ID,IMAGE) VALUES(1,LOAD_FILE('C:/path.jpg'));

This option save a null value in the field, when realise select rows of the table, the result is a null value and also don't work in a sql php query.

Any idea?

you can save as LONGBLOB datatype in mysql, to store it binary in the database.

CREATE TABLE pictures (
    'id' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    'image' LONGBLOB NOT NULL,
  PRIMARY KEY ('id')
)

then

$sql = "INSERT INTO pictures(image)               
        VALUES('".file_get_contents($tmp_image)."')";