Welcome Guest, Not a member yet? Register   Sign In
count_all_results returns a string?
#4

[eluser]jedd[/eluser]
Yes and no.

There isn't a 1:1 mapping of datatypes between MySQL and PHP, so there will always be exceptions and complications to deal with here.

Having said that, there is a reasonable expectation that numeric results return as numeric datatypes rather than string. OTOH there's a certain reliability about knowing that PHP will take every MySQL result and present it as a string type.

There was a [url="http://ellislab.com/forums/viewthread/110393/"]thread recently on this subject[/url] and Samuel came up with a nifty helper function that will meet you half way with this. Alternatively you can hack the core DB code if you want to get extra points.

Note that this is a PHP problem / feature - you can test it with the half dozen MySQL libraries for PHP (though there's really only one in use these days) to confirm for yourself. It'd be a big call for a framework to start munging datatypes on the way through - it would make your code cleaner, yes, but it would also make your code totally reliant on that framework from that point on. This is probably not a good thing for a framework to do.


Messages In This Thread
count_all_results returns a string? - by El Forum - 04-03-2009, 08:51 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 08:54 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 09:03 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 09:45 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 10:49 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 01:25 PM
count_all_results returns a string? - by El Forum - 04-03-2009, 01:54 PM
count_all_results returns a string? - by El Forum - 04-04-2009, 09:57 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 04:09 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 04:30 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 04:56 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 06:06 AM
count_all_results returns a string? - by El Forum - 04-08-2009, 10:50 AM
count_all_results returns a string? - by El Forum - 04-08-2009, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB