Re: implode() in MDB_QueryTool - decimal-point -> comma

From: Date: Sun, 14 May 2006 21:14:02 +0000
Subject: Re: implode() in MDB_QueryTool - decimal-point -> comma
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24074@lists.php.net to get a copy of this message
On 5/14/06, Lukas Ruetz <lukas.ruetz@gmx.at> wrote:
Am Sonntag, 14. Mai 2006 20:46 schrieb Justin Patrin: On 5/14/06, Lukas Ruetz <lukas.ruetz@gmx.at> wrote:
Am Sonntag, 14. Mai 2006 19:25 schrieben Sie:
Lukas Ruetz wrote:
I'm not sure if this has anything to do with QueryTool but in every case there is something wrong with implode() The symptom is that I can't insert floats because the decimal-points become commas in MDB/QueryTool/Query.php -> add(). var_dump shows me that my floats in the array have the correct type, but if the array is processed by implode() the decimal-points become commas in the resulting string. The strange thing is that implode(', ', $newData) does this incorrect transforming inside Query.php but _not_ if i test this in a simple script where implode() leaves the decimal-point untouched.
A reproducing script would be helpful, since I can't see how that implode() call would break your script. Regards,
I wanted to write a simple script that reproduces the error, but like I said before, in a simple script the error is gone. Finally I could see that the error occures only if I use the DB-code inside Flexy-page-classes. Although QueryTool is influenced by "something" it isn't the cause. This is a really strange error - I will search on tomorrow.
"Something" is changing the locale of your numbers. I suggest checking your "float" in various parts of your script. Perhaps it's Flexy, perhaps it's a function that QueryTool calls (it's not the implode, look elsewhere), and perhaps it's something else your script is doing. -- Justin Patrin Hi! Of course it's the locale *argh* - I set the locale in Flexy/Translation2.. I thought, because the float is correct in the array it has to be converted the right way. But implode() returns floats regarding to the current locale. So if I switch to english it's working, but if I use my german locale, implode() will convert the decimal-point "corretly" to our decimal-comma. But this is useless for the SQL-syntax. Can I change this behaviour of PHP in combination with a western-europe locale? Otherwise the QueryTool has to deal with float values in a different way.
http://us2.php.net/implode That function has nothing to do with locales. -- Justin Patrin

« previous php.pear.general (#24074) next »