#34022 [Opn->Bgs]: prepared statement using blobs doesnt function
| From: | sniper@php.net | Date: | Sat, 06 Aug 2005 23:39:01 +0000 |
| Subject: | #34022 [Opn->Bgs]: prepared statement using blobs doesnt function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83110@lists.php.net to get a copy of this message | ||
ID: 34022
Updated by: sniper@php.net
Reported By: mike dot norton at ultisearch dot co dot uk
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
Operating System: Fedora Core 3
PHP Version: 5.0.4
New Comment:
RTFM:
http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php
Previous Comments:
------------------------------------------------------------------------
[2005-08-07 00:54:16] mike dot norton at ultisearch dot co dot uk
Description:
------------
When using mysql with bind_params on blob data only the first 4 bytes
of data get included.
Reproduce code:
---------------
<?php
$mysqli = new mysqli("localhost", "user", "pass", "db");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$filename = "/path_to/files/5_copy14.jpg";
/* create a prepared statement */
$stmt = $mysqli->stmt_init();
$stmt->prepare("insert into user_image (image) values (?)");
$data = fread(fopen($filename, "rb"), filesize($filename));
$stmt->bind_param('b',$data); /* Prove that the $data variable
contains the correct data */
print $data;
$stmt->execute();
$stmt->close();
$mysqli->close();
?>
Expected result:
----------------
Image is displayed and image data is inserted into database
Actual result:
--------------
First 4K of image is inserted into database rest seems to be discarded
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34022&edit=1