I wonder why the PDO::PARAM_FLOAT does not exist and what can replace it?
Asked
Active
Viewed 1.7k times
15
-
did the answer helped you? if so accept – Valerij Aug 13 '12 at 14:05
-
This was closed as a duplicate of https://stackoverflow.com/questions/2718628/pdoparam-for-type-decimal but only the second question asked here is answered there. – symcbean Dec 28 '18 at 14:49
1 Answers
5
There is none, probably due to implied rounding issues.
Just use PDO::PARAM_STR
and convert the float to a string using strval($float)
or (string) $float
.

apfelbox
- 2,625
- 2
- 24
- 26
-
4This won't work because the class constant `PDO::PARAM` doesn't exist. However, if you replace that by `PDO::PARAM_STR` it would work. And you don't have to convert the float to a string. – Serrano Aug 15 '12 at 22:10