Data loss problem when importing Excel database (sometimes good or bad)

WBOY
Release: 2016-08-08 09:26:06
Original
2035 people have browsed it

Recently, I have been developing the excel import resume (excel file) function. When importing excel, the data inserted into the database often appears to be incomplete (only part of the data), so I print the obtained data in the excel table before inserting,

It was found that what was printed was a rich text object (composed of unformatted text, control words, and control symbols. For example, the fonts in excel include Song Dynasty, Kaili, and other font formats). This is the root cause of the insertion failure.

Solution: Type cast to string

Before change:


After change:

The problem is solved,,, it’s that simple, I hope it can help you who are troubled!

The above has introduced the data loss problem (sometimes good and sometimes bad) when importing Excel into the database, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template