Welcome Guest, Not a member yet? Register   Sign In
Data type changes when selecting using Active Record
#2

[eluser]Walter Coots[/eluser]
I don't have a definite answer, but it may have to do with PHP's type juggling (manual). One solution is to cast it as an integer by typing (int) before using it. It's kind of annoying having to do it at the point of need, so maybe you could cast all values as the appropriate types in your model.

Code:
$is_something = (int) $is_something;
$some_html = ($this_item->is_something === 0) ? 'is zero' : 'is not zero';


Messages In This Thread
Data type changes when selecting using Active Record - by El Forum - 12-04-2010, 08:23 PM
Data type changes when selecting using Active Record - by El Forum - 12-05-2010, 01:05 PM
Data type changes when selecting using Active Record - by El Forum - 12-05-2010, 11:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB