|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-13 05:06 UTC] georg@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 07:00:01 2025 UTC |
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