CodeIgniter Forums
tinyint(1) not returning it's value - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: Issues (https://forum.codeigniter.com/forum-19.html)
+--- Thread: tinyint(1) not returning it's value (/thread-77908.html)



tinyint(1) not returning it's value - superior - 11-03-2020

Hello,

I'm currently using CodeIgniter 3.1.11, in there i'm writing a simple helper to get single fields from the query based on users UUID(). These are mostly settings in example ToggleSidebar can be 0 (off) or 1 (on). But to retrieve these fields it's not working, i've been searching for typos and direct writing in my query (that works).

quick test on value change, when set to 1 (on) it's no issue, the issue is in the fact it doesn't allow 0 (off) values in the fields.

Other columns with a varchar(45) have no issues to get those values, only the tinyint(1) columns seem to have this issue. Does anybody have encountered the same issue and resolved this in some way? In my case it's not possible to re-design the database columns so i need a work-around or a code fix for this.


Edit, found fix:
Have found a fix or what you can call a work-around, when returning the value as result_array() you can select the first index and column you desire. This method seems to work just fine without changing much on the code part, personally think it's in the row() query helper that doesn't allow 0 values to be returned.

Thank you!

Kind Regards