note 101764 added to pdostatement.bindparam
| From: | cyrylas at gmail dot com | Date: | Mon, 10 Jan 2011 09:23:01 +0000 |
| Subject: | note 101764 added to pdostatement.bindparam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175593@lists.php.net to get a copy of this message | ||
Please note, that PDO format numbers according to current locale. So if, locale set number format to
something else, that standard that query WILL NOT work properly.
For example:
in Polish locale (pl_PL) proper decimal separator is coma (","), so: 123,45, not 123.45.
If we try bind 123.45 to the query, we will end up with coma in the query.
<?php
setlocale(LC_ALL, 'pl_PL');
$sth = $dbh->prepare('SELECT name FROM products WHERE price < :price');
$sth->bindParam(':price', 123.45, PDO::PARAM_STR);
$sth->execute();
// result:
// SELECT name FROM products WHERE price < '123,45';
?>
----
Server IP: 195.114.0.19
Probable Submitter: 91.209.116.11
----
Manual Page -- http://www.php.net/manual/en/pdostatement.bindparam.php
Edit -- https://master.php.net/note/edit/101764
Del: integrated -- https://master.php.net/note/delete/101764/integrated
Del: useless -- https://master.php.net/note/delete/101764/useless
Del: bad code -- https://master.php.net/note/delete/101764/bad+code
Del: spam -- https://master.php.net/note/delete/101764/spam
Del: non-english -- https://master.php.net/note/delete/101764/non-english
Del: in docs -- https://master.php.net/note/delete/101764/in+docs
Del: other reasons-- https://master.php.net/note/delete/101764
Reject -- https://master.php.net/note/reject/101764
Search -- https://master.php.net/manage/user-notes.php