Jump to content

Recommended Posts

I am having trouble storing a "string" of charaters (encoded from a whole number value) in a blob field. I can produce the character sequence with php functions. However, the database seems to add a few characters to the string value I supply between quotes in an UPDATE query . Does any php function predict what is happening in the UPDATE statement here so that I can retrieve to same sequence I intended to store?
I am building a web application that saves and retrieves data from mySQL - often as a series of numeric values (of specific data type and size) laid down in blob fields.

Retieval from blob fields is straight-forward using SELECT SQL in a mysql_query() - I can divide up the field result as though it was a string.

Laying down a predictable series of numeric values in a bolb field is difficult but possible using LOAD DATA INFILE. The numeric value can be encoded into bytes - values ranging 0 - 255, each byte is understood to require multiplication by 256 to the power of its position - 1 in the sequence. The value of each byte can be converted to a character - sometimes escaped with slashes:

Using LOAD DATA INFILE is clearly inelegant for single assignments but an UPDATE query just seems to add bytes to the blob which I don't understand.
As I said, is there any php functions that can predictably reproduce what happened to the blob field or even decode it back?
Link to comment
https://forums.phpfreaks.com/topic/5628-update-statement-with-blob-fields/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.