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: '002
That 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.
假设您要在通过PHP MySql查询导出为CSV时将电话号码设置为“ 0”开头,只需将结果数据写入如下
'="'.$result['telephone'].'"'
have you seen this export lib which use a building block method like Google AppInventor?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.