inserting blobs into mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i'm having trouble getting binary data into blobs in mysql.

to help debug, i set up a test db and discovered that when i insert a binary
string encoded using mysql_real_escape_string (according to the php manual:
"If binary data is to be inserted, this function must be used."), only byte
values lower than 128 are accepted. all bytes in the string with value
greater equal 128 are stripped out upon insertion, regardless where they
appear in the string.


so, for example if i create a test binart string thus:

    $data = '';
    for ( $n=0; $n<=127; $n++ )
        $data .= chr($n) . chr($n+128);

and inset it (using mysql_real_escape_string), the blob value that appears
as viewed with phpmyadmin is only 128 bytes long. and when i select it, the
value i get back is the same as if i had inserted:

    $data = '';
    for ( $n=0; $n<=127; $n++ )
        $data .= chr($n);

any idea why?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux