Larry Bradley wrote:
I'm new to PHP, although I've been a programmer all my life. I had been
doing a bit of web database work with VB Script and ASP and mySQL, and
then decided to try PHP. I've run into a couple of things that bother me.
I have boolean fields (i.e. bit(1)) in the mySQL database. When I
retrieve data from the mySQL server into an array or an object, it seems
as if all the data fields are returned as characters. For most data
types this does not matter, since PHP will handle them properly. This an
integer 46 being retrieved as a character '46' is OK.
However, the boolean is a curse, as it comes back as a character
containing hex 00 or hex 01, and I have to use a test such as:
if (ord(IsAMember) == 0) ...
I can't just treat it as a boolean.
I have got around the problem by using a construct such as:
select if(IsAMember,1,0) as IsAMember
in the SQL select, but this is a bit of a pain.
Orleans (Ottawa), Ontario, CANADA
Try using a set() field with values true and false
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php