0

My question reflects to old question with little change. I am fetching values from MySQL db table datatype for the field is varchar(32) & it stores values like:

1.497e-05 and so on.

and I want to show 1.497e-05 as 0.00001497

i tried as mentioned here Convert exponential number presented as string to a decimal but fail.

One thing more i am trying to insert 0.00001497 to table but it stores as 1.497e-05 it though field datatype is varchar(32)

Community
  • 1
  • 1
PHP Ferrari
  • 15,754
  • 27
  • 83
  • 149
  • No, it almost certainly writes the correct value; but MS Excel formats it as scientific.... open the file in a text editor to verify – Mark Baker Feb 27 '13 at 07:43
  • nop in notpad it is showing 497e-05 – PHP Ferrari Feb 27 '13 at 09:40
  • So how are you writing the file? Are you casting these varchars to float? If so, don't – Mark Baker Feb 27 '13 at 09:52
  • no i just pic values from table and push on file cell. – PHP Ferrari Feb 27 '13 at 10:02
  • what if the value was `1.497e-15` you want `0.000000000000001497` ? – जलजनक Feb 27 '13 at 10:07
  • File cell? You're using an array of values returned from MySQL and fputcsv() to write to file? – Mark Baker Feb 27 '13 at 10:07
  • One thing more i am trying to insert `0.00001497` to table but it stores as `1.497e-05` it though field datatype is varchar(32). If it is fixed then I am sure there will be no issue to store in csv. – PHP Ferrari Feb 27 '13 at 10:08
  • How are you opening the csv? excel or notepad? excel autodisplays float numbers in exponential notation. There is no way that a varchar value saved as "0.00001497" gets converted into exponential notation without tampering. Some code would be nice – cernunnos Feb 27 '13 at 10:14

0 Answers0