note 39370 modified in function.setlocale by irchtml
| From: | irchtml@php.net | Date: | Wed, 18 Feb 2004 01:16:40 +0000 |
| Subject: | note 39370 modified in function.setlocale by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65329@lists.php.net to get a copy of this message | ||
Be carefull - setting a locale which uses commas instead of dots in numbers may cause a mysql db not
to understand the query:
<?php
setlocale(LC_ALL,"pl");
$price = 1234 / 100; // now the price looks like 12,34
$query = mysql_query("SELECT Id FROM table WHERE price='".$price."'");
?>
Even if there is a price 12.34 - nothing will be found
--was--
<p>Be carefull - setting a locale which uses commas instead of dots in numbers may cause a
mysql db not to understand the query:</p>
<?php
setlocale(LC_ALL,"pl");
$price = 1234 / 100; // now the price looks like 12,34
$query = mysql_query("SELECT Id FROM table WHERE price='".$price."'");
?>
<p>Even if there is a price 12.34 - nothing will be found</p>
http://www.php.net/manual/en/function.setlocale.php