Problems with Boolean values

General usage of Access to MySQL

Moderator: jr

Post Reply
stevio
Posts: 2
Joined: Fri Oct 23, 2009 3:05 pm

Problems with Boolean values

Post by stevio »

I am having some problems with Boolean values in MySQL. I used the Bullzip Access to MySQL application to convert a database from Access to MySQL.

In Access, I had some Yes/No fields. These were converted to fields defined as follows:
`ACTIVE` TINYINT NOT NULL DEFAULT 0

This creates a TINYINT(4), with false values set to 0 and true values set to -1. However, Boolean true values should be 1 in MySQL from what I have read.

When I test my PHP pages locally on my PC with the following SQL WHERE clause:
WHERE ACTIVE is True
it works. However, this WHERE clause fails when I try to run my query on the server of my hosting company.

I have MySQL Client Version 5.1.11 on my local PC, and the hosting server has MySQL client version: 5.0.51a.

What should I do? Can I work around this or should I convert all -1 values to 1, or do I first need to change the data type of the ACTIVE field to BOOLEAN or BOOL?

Any suggestions are welcome.
Thanks,
Stephen
Post Reply