PHP reads decimals with commas instead dots
792182Aug 18 2010 — edited Aug 19 2010I have a script that copies Oracle table to Firebird/Interbase.
Oracle database is set to:
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_LANGUAGE POLISH
NLS_TERRITORY POLAND
NLS_CURRENCY zl
NLS_ISO_CURRENCY POLAND
NLS_NUMERIC_CHARACTERS ,
I have a problem with decimals returned by Oracle. Query result has decimals with "," what causes conversion error on insert to Firebird.
Is there a way to configure conection parameters to receive numbers formated with "."
I could go through each row value to check if it's decimal and substitute "," to ".", whitch will add extra processing to the script
At the moment I supply INSERT statement values as shown bellow
For each
$row = oci_fetch_assoc($stmt)
I create array with parameters strings
$params[$k] = '$row[\''.$k.'\']';
and finally evaluate:
eval('ibase_execute($prep_query,'.join(',',$params).');');