After php imports an excel file into the MySQL database, how can it be displayed in text format?

Source: Internet
Author: User
After php imports an excel file into the MySQL database, how does php display it in text format? after php imports an excel file into the MySQL database, how does php display it in text format?
For example, excel contains 9787509345030
After the database is imported, it becomes 9.78750934503E + 12.
Php reads the database data and finds that it is also 9.78750934503E + 12.
Very angry, asking for help, very complicated mood.
It seems to be numeric.
$ Number = implode ('', explode ('-', $ data-> sheets [0] ['cells '] [$ I] [1]);
$ Number = strval ($ number );
Turn it into a string type. why is the meter or numeric type ????


Reply to discussion (solution)

Your 9787509345030 in excel is not stored in the form of strings ('123'), but modified in the form of a style sheet (otherwise it is also represented in scientific notation)
You can try to use the getFormattedValue method instead of the getValue method.

Your $ data-> sheets [0] ['cells '] [$ I] [1] is faulty.

I learned from CSDN alone
$ Data = new Spreadsheet_Excel_Reader ();
$ Data-> setOutputEncoding ('utf-8 ');

$ Data-> read ($ upload_file_name );

For ($ I = 2; $ I <= $ data-> sheets [0] ['numrows ']; $ I ++)
{
$ User_name = $ _ SESSION ['User _ name'];
$ Book_isbn = $ data-> sheets [0] ['cells '] [$ I] [1]);
$ Book_name = $ data-> sheets [0] ['cells '] [$ I] [2];
$ Book_press = $ data-> sheets [0] ['cells '] [$ I] [3];
}
How did you write it?
How did I write formatted reads? I read the official PHP file and didn't understand it at the moment.

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.