When exported as an excel file in PHP, the ID card is displayed in scientific notation. how can this problem be properly displayed?

Source: Internet
Author: User
When exported as an excel file in PHP, the ID card is displayed in scientific notation. how to properly display the ID card column in the generated excel file when PHP exports the records in the database as an excel file, but it is displayed in scientific notation. I don't know how to display it all. The code is as follows: & lt ;? Php & nbsp; header (& quot; contenttexthtml; charsetgb2312 & quot;) when the PHP file is exported as an excel file, the ID card is displayed in scientific notation. how can it be properly displayed?
When PHP exports the records in the database as an excel file, the ID card column in the generated excel file is displayed in scientific notation,
I don't know how to display it all. The code is as follows:
Header ("content = text/html; charset = gb2312 ");
Header ("Content-type: application/vnd. ms-excel ");
Date_default_timezone_set ('prc'); // solves the problem that the time is 8 hours earlier;
Header ("Content-Disposition: attachment; filename =". date ('Y _ m_d_H_ I _s '). ". xls ");
Echo"















";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";$ I = $ number;While ($ rows = mysql_fetch_array ($ result )){Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";$ I --;}Echo"
Student Information Table
Serial NumberStudent NameID card number
". $ I ."". $ Rows ['app _ name']."". $ Rows [" app_id_card "]."
";
?>
It must be noted that the field attribute of the ID card in the database uses: varchar

In addition, if you add'

Echo"'". $ Rows [" app_id_card "]."";

In excel, the ID card is also displayed in full, but there is ',
Double-click the cell and the cell will generate a small triangle in the upper left corner.



------ Solution --------------------
Stored in text format
------ Solution --------------------
Echo"". $ Rows [" app_id_card "]."";

In this way, you can

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.