I want to export sql query results as table on an XLS file (or anything that can be opened as table on ms excel)
I’ve tried this one » PHP code to convert a MySQL query to CSV
however, it removes any leading zeros on the result
how do I maintain/preserve the leading zeros?
Add a single quote before the first zero, like that:
'002That mean you should maybe define which columns are text and which are numbers, and force every text columns to begin witha single quote. A number with 0 prefix is not a number but a text in this way.