#34022 [Bgs->Csd]: prepared statement using blobs doesnt function
| From: | mike dot norton at ultisearch dot co dot uk | Date: | Sun, 07 Aug 2005 17:28:46 +0000 |
| Subject: | #34022 [Bgs->Csd]: prepared statement using blobs doesnt function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83138@lists.php.net to get a copy of this message | ||
ID: 34022
User updated by: mike dot norton at ultisearch dot co dot uk
Reported By: mike dot norton at ultisearch dot co dot uk
-Status: Bogus
+Status: Closed
Bug Type: MySQLi related
Operating System: Fedora Core 3
PHP Version: 5.0.4
New Comment:
Seems to work with that function correctly
Previous Comments:
------------------------------------------------------------------------
[2005-08-07 01:39:00] sniper@php.net
RTFM:
http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php
------------------------------------------------------------------------
[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