PDO::PARAM for type decimal?
There isn't any PDO::PARAM
for decimals / floats, you'll have to use PDO::PARAM_STR
.
What is the best way to bind decimal / double / float values with PDO in PHP?
AFAIK PDO::PARAM_STR is the way to go.
Why I can not insert 0.00 decimal value with PDO into my database?
The answer in comments pointed me to the right direction. Problem lies not in decimal 0.00
, but in foreign key which im trying to set to an empty string, which is invalid NULL and foreign key.
A quick fix would be to check if string is empty and set it to NULL:
if (empty($position['order'])) {
$position['order'] = NULL;
}
Cannot update mysql with PDO when variable is a decimal
Hello Guys: I finally figured out that the problem was totally unrelated to what I posted; I am sorry if I wasted anyone's time and I appreciate all of your help…
Basically there was a function "higher up in the stream" that was making it fail - and it had nothing to do with non-integers being entered; but because with this function they were always non-integers it really looked like that was the cause...
Related Topics
Remove Accents Without Using Iconv
How to Replace a Function in PHP (Such as Mail) and Make It Do Something Else
Mcrypt Rijndael-128 to Openssl Aes-128-Ecb Conversion
PHP Simplexml Check If a Child Exists
Header Location Not Working in My PHP Code
How to Correct This Illegal String Offset
Skip First Line of Fgetcsv Method
How to Split a String in PHP at the Nth Occurrence of a Needle
Wordpress Prepared Statement with In() Condition
PHP Unexpected Result of Float to Int Type Cast
Custom Order Status Background Button Color in Woocommerce 3.3 Admin Order List
PHP Syntax for Arrays: Different Behaviour Between PHP Versions