Take the 2-minute tour ×

Has anyone ever experienced a problem where a value from a field in a database with BIT data type can not be put into a SESSION variable? I was using a BIT type to determine if someone had access to certain parts of a site and when they logged in, their information would be stored into session variables (UserID, Username, etc...)

I tried the same with the BIT field but the SESSION variable for that always came up null when I echoed it out. I fixed it by changing the datatype to INT, but is there a way to work with BIT types and SESSION variables?

share|improve this question
values from the database almost always come back as PHP strings. If you're having trouble, it's probably unrelated to the database, and purely an issue of misusing session. It'd be easier to help with that if you could provide some code. Also, which database are you using? mysql? mssql? postgres? oracle? Which database driver? –  Frank Farmer Oct 5 '12 at 21:29
var_dump() is your friend; use it on the data you get from the database to help diagnose the problem. –  G-Nugget Oct 5 '12 at 21:58
add comment


Your Answer



Browse other questions tagged or ask your own question.