PDA

View Full Version : mysql problem - changes bool to tinyint


kdd
08-23-2005, 06:49 PM
after i selcted bool in Data Type, and try to save it, it automatically changes it to tinyint, and then if i try to change it back to bool, and save it, it reports error. what's up with it? how can it select bool?

sWo0p
08-23-2005, 07:07 PM
well i can tell you im in a simular possition.. :D DB does'nt take a date and is strugeling with prijcing.. (99,99.00) but i'll get it..

what do you wanne add in bool row??? (and i just took a peek in my phpmyadmin.. but WTF is bool) ?

kdd
08-23-2005, 07:17 PM
bool means boolean (true or false). i want to have true or false conditions in bool row. :)

hl
08-23-2005, 07:34 PM
have you tried running a query instead of just using the create a table thing?

kdd
08-23-2005, 09:37 PM
nope let me try that, thanks :)

kdd
08-23-2005, 11:11 PM
ok, i just found out about this from another forum.
in mySQL, there really is no boolean field type. BIT, BOOL and BOOLEAN are simply synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.
i was still writing the sql query. great (sarcastically)

hl
08-23-2005, 11:23 PM
never knew that. then again never used the bool thing. i just use text or int :P

icio
08-24-2005, 05:35 AM
couldn't you do something like:
$row['boolField'] = $row['boolField'] ? true : false;
so that it converts the 1/0 to true/false.

hope this helps :thumb:

Ilija Studen
08-24-2005, 08:48 AM
Or:

$row['boolField'] = (boolean) $row['boolField'];