#37421 [Opn->Bgs]: mysql_bind_param() and BLOB-fields

From: Date: Sat, 13 May 2006 05:06:14 +0000
Subject: #37421 [Opn->Bgs]: mysql_bind_param() and BLOB-fields
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97037@lists.php.net to get a copy of this message
 ID:               37421
 Updated by:       georg@php.net
 Reported By:      lars at strojny dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         MySQLi related
 Operating System: Linux
 PHP Version:      5.1.4
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Please check the sample at
http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php

how to handle blobs.


Previous Comments:
------------------------------------------------------------------------

[2006-05-12 18:45:09] lars at strojny dot net

Description:
------------
Using mysqli in combination with the prepare-method and bind_param
leads to troubles with the BLOB-field. I'm not really sure if it is a
bug or I just thinking the wrong way.

Reproduce code:
---------------
<?php
$m = new mysqli( "host, "user", "pass" );
$m->select_db( "my_db" );
if( $statement = $m->prepare( "INSERT INTO my_table SET my_blob = ?"
))
{
   $file = file_get_contents( "image.png" );
   $statement->bind_param( 'b', $file );
   $statement->execute();
}
?>

Expected result:
----------------
Image should be inserted as binary data into the MySQL-table.

Actual result:
--------------
This does not work, it just puts zero bytes into the database. If I
change $statement->bind_param( 'b', $file ); to $statement->bind_param(
's', $file ); it works as expected


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37421&edit=1


Thread (2 messages)

« previous php.bugs (#97037) next »