Welcome Guest, Not a member yet? Register   Sign In
tinyint(1) not returning it's value

(This post was last modified: 11-04-2020, 01:08 AM by superior. Edit Reason: Found a fix/work-around )


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

Theme © iAndrew 2016 - Forum software by © MyBB