Question

So here is my problem.

I have a field in my database called maillist with the type tinyint(1). Using phpmyadmin i inserted into some fields the values 0's and 1's.
When i read from the database here is the array returned.

Array
(
    [User] => Array
        (
            [maillist] => 
        )

)

Where the maillist should be 0 or 1 because in my database all the fields on the maillist are filled.
So i decided to change the type on the field to tinyint(4) and that fixed the problem are here is the returned array.

Array
(
    [User] => Array
        (
            [maillist] => 0
        )

)

Please note that i did not change any values i just changed the type from tinyint(1) to tinyint(4).
Although the problem is fixed i would like to know what might have caused this behavior ? do i have a lack of understanding in retrieving data using cakephp ? Did i miss something important ? Or this might have been a bug.

Était-ce utile?

La solution

Try var_dump($array) instead of pr($array)

pr() does not show variable types and will never show booleans as there is no true or false character.

http://codepad.viper-7.com/tUvSTu

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top