FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP code to know decimal character in MYSQL





iyepes
I'm coding a PHP application and I have to handle a float value. I have a trouble since depending on the IOS language, the decimal separator can be dot (.) or comma (,). Do you know a code in PHP that allow me to know which of them a IOS is using before inserting a datum into a MYSQL table?

Thanks for your help.
jmraker
Does using a dot in the decimal value cause an error?

If the format varies within the database you might be able to figure out which ones by getting the table's collation with
SHOW TABLE STATUS
and a field's collation with
SHOW FULL COLUMNS FROM $table

Some useful functions might be
money_format - http://us2.php.net/manual/en/function.money-format.php
number_format - http://us2.php.net/number_format

Quote:
(from one of the comments on php.net)
function something($number)
{
$locale = localeconv();
return number_format($number,
$locale['frac_digits'],
$locale['decimal_point'],
$locale['thousands_sep']);
}
iyepes
I was talking about an input field in a html form, which comes from a database and will be recorded again after a modification.

I solved it with a simple search function in javascript, thanks.
Related topics
Show PHP Code
PHP CODE INCLUSION
mySQL Query/PHP code - get the highest value...
my PHP code benchmark script that got some problems
PHP code snippit?
CSS for making images go through a php code.
Gradient Fill Cell
any freeware php report generator
What is a good or bad php code?
ayuda en: PHP + APACHE WEB SERVER + MYSQL
I want PHP Code to ......
PHP search function with MySQL fulltext
Help With Simple PHP Code Snipit
removing DirectAdmin part of URL makes php code work
Highlight PHP-code in a HTML-document
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.