PHP firebird insert blob file into the database ap

2019-02-28 01:02发布

I'm currently working on inserting image on the firebird database and it's working fine alone, see the code below.

$dbh = ibase_connect($host, $user, $pass);

$blh = ibase_blob_create($dbh);   
ibase_blob_add($blh, $data);
$blobid = ibase_blob_close($blh);

$sql = "INSERT INTO blobtable(blobfield) VALUES (?)";  
$sth = ibase_query($dbh, $sql, $blobid);

but when I add some data on the insert statement suddenly the apache crash and stops working. See below code when I add new data.

$dbh = ibase_connect($host, $user, $pass);

$blh = ibase_blob_create($dbh);   
ibase_blob_add($blh, $data);
$blobid = ibase_blob_close($blh);

$sql = "INSERT INTO blobtable(name, desc, blobfield ) VALUES (?, ?, ?)";   
$sth = ibase_query($dbh, $sql, $name, $desc, $blobid);

1条回答
看我几分像从前
2楼-- · 2019-02-28 01:30

See the blob_create function in this gist:

https://gist.github.com/rowland/d59ee296f8be4b581fed

Probably your $data is larger than the maximum segment size.

查看更多
登录 后发表回答