Mohammad Masoudian Mohammad Masoudian - 10 months ago 48
SQL Question

numbers issue after export mysql data to CSV

when i get data from database and export it as a csv file i have following issues :

  • the leading zero of the numbers dosnt show

  • big numbers shows like this ->

how to force MS Excel to show all of my data as string by PHP

Kai Kai

You can use double quotes contain the numbers, like this:

if(is_numeric($column)) $column = '"'.$number.'"';