I'm not sure how to handle this one, and I've tried what to me are the most obvious solutions, but so far none have proved entirely satisfactory. I must be overlooking something very simple, since it isn't mentioned in any literature on PHP that I've researched.

I have a value which is essentially a bitmask although a little more complex. Perhaps a better description would be "encoded value". I store this in a field in a mysql database, but the problem I have is that I need to edit it. It is broken apart, and converted to various html widgets within the application, reassembled and submitted via an sql update to the database.

The problem occurs when (this is a 32 bit machine - an intel PII) the 'sign' bit is set in the encoding process. I can't find any way of printing the UNSIGNED value of this bit - whether I print in hexadecimal (which I would have thought to always assume it is an unsigned quantity by default) or decimal, I can't seem to do it. But I need to find a way so that it will successfully update.

I'm starting to think the best way to handle this is by using functions from the sql interpreter, but I'm worried that if I do, I'll make my code (which uses phplib-7) less database 'portable'.

Any thoughts or comments welcome, either by email or here.